diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig index fd878420d57..4f5314ab69e 100644 --- a/eng/Common.globalconfig +++ b/eng/Common.globalconfig @@ -373,7 +373,7 @@ dotnet_diagnostic.CA2153.severity = none dotnet_diagnostic.CA2201.severity = none # Instantiate argument exceptions correctly -dotnet_diagnostic.CA2208.severity = suggestion +dotnet_diagnostic.CA2208.severity = warning # Non-constant fields should not be visible dotnet_diagnostic.CA2211.severity = none diff --git a/src/Build.OM.UnitTests/TransientIO.cs b/src/Build.OM.UnitTests/TransientIO.cs index 982474d02ea..efdf7a97cff 100644 --- a/src/Build.OM.UnitTests/TransientIO.cs +++ b/src/Build.OM.UnitTests/TransientIO.cs @@ -79,7 +79,7 @@ public string GetAbsolutePath(string relative) var absolute = Path.GetFullPath(Path.IsPathRooted(relative) ? relative : Path.Combine(tempRoot, relative)); if (!IsControled(absolute)) { - throw new ArgumentException(nameof(relative)); + throw new ArgumentException("Either the path is invalid or it is not rooted to RootFolder.", nameof(relative)); } return absolute; diff --git a/src/StringTools/InternableString.Simple.cs b/src/StringTools/InternableString.Simple.cs index 88126da5c6f..9ef590be148 100644 --- a/src/StringTools/InternableString.Simple.cs +++ b/src/StringTools/InternableString.Simple.cs @@ -20,7 +20,8 @@ public static string AsSpan(this T[] array, int start, int length) { return new string(charArray, start, length); } - throw new ArgumentException(nameof(array)); + + throw new ArgumentException("array is not char array.", nameof(array)); } } } diff --git a/src/Tasks/ManifestUtil/TrustInfo.cs b/src/Tasks/ManifestUtil/TrustInfo.cs index 1652655417d..c8c501b5e8c 100644 --- a/src/Tasks/ManifestUtil/TrustInfo.cs +++ b/src/Tasks/ManifestUtil/TrustInfo.cs @@ -412,7 +412,7 @@ public bool IsFullTrust public PermissionSet PermissionSet { get => GetOutputPermissionSet(); - set => _outputPermissionSet = value ?? throw new ArgumentNullException("PermissionSet cannot be set to null."); + set => _outputPermissionSet = value ?? throw new ArgumentNullException(nameof(value), "PermissionSet cannot be set to null."); } #endif