diff options
author | Herman Eldering <HermanEldering@users.noreply.github.com> | 2019-06-23 04:52:42 +0200 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-06-22 19:52:42 -0700 |
commit | 248f087b8db718880c82ccd95286c133f2c36ec8 (patch) | |
tree | 0e5746c93c8840286e384c5992a0d9b122e1dee0 /src/System.Private.CoreLib | |
parent | 7dceb4c5eb991794ceca27a45c56b91119a742da (diff) | |
download | coreclr-248f087b8db718880c82ccd95286c133f2c36ec8.tar.gz coreclr-248f087b8db718880c82ccd95286c133f2c36ec8.tar.bz2 coreclr-248f087b8db718880c82ccd95286c133f2c36ec8.zip |
ArgumentException: use system-supplied message if message is null (#25115)
Enable using a system-supplied message while also providing an argument/parameter name by passing in a null message. Made to match the behavior of FileNotFoundException.
Diffstat (limited to 'src/System.Private.CoreLib')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/ArgumentException.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/ArgumentException.cs b/src/System.Private.CoreLib/shared/System/ArgumentException.cs index a803b1a426..33ff93251d 100644 --- a/src/System.Private.CoreLib/shared/System/ArgumentException.cs +++ b/src/System.Private.CoreLib/shared/System/ArgumentException.cs @@ -78,6 +78,8 @@ namespace System { get { + SetMessageField(); + string s = base.Message; if (!string.IsNullOrEmpty(_paramName)) { @@ -88,6 +90,14 @@ namespace System } } + private void SetMessageField() + { + if (_message == null && HResult == System.HResults.COR_E_ARGUMENT) + { + _message = SR.Arg_ArgumentException; + } + } + public virtual string? ParamName { get { return _paramName; } |