diff --git a/.editorconfig b/.editorconfig index 5311eb964aa..234c927d8d3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -202,3 +202,7 @@ end_of_line = crlf [src/**/*.{cs,vb}] # IDE0005: Remove unnecessary usings/imports dotnet_diagnostic.IDE0005.severity = warning + +[.nuget/**/*.cs] +# Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = suggestion diff --git a/.vsts-dotnet-ci.yml b/.vsts-dotnet-ci.yml index dce7ac92550..f1ad1ed0893 100644 --- a/.vsts-dotnet-ci.yml +++ b/.vsts-dotnet-ci.yml @@ -3,6 +3,10 @@ trigger: - exp/* - vs* +variables: + - name: NUGET_PACKAGES + value: $(Build.SourcesDirectory)/.nuget/packages + jobs: - job: BootstrapMSBuildOnFullFrameworkWindows displayName: "Windows Full" diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index c6ed508dfc8..697d43b3092 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -36,6 +36,8 @@ variables: value: .NETCore - name: _DotNetValidationArtifactsCategory value: .NETCoreValidation + - name: NUGET_PACKAGES + value: $(Build.SourcesDirectory)/.nuget/packages stages: - stage: build diff --git a/NuGet.config b/NuGet.config index 9b4c6f6759c..2b871a91f72 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,5 +1,9 @@ + + + + diff --git a/eng/Common.globalconfig b/eng/Common.globalconfig index cb71d55758c..f8c199d9c6c 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 @@ -1107,4 +1107,4 @@ dotnet_diagnostic.SA1649.severity = suggestion dotnet_diagnostic.SA1652.severity = none # Do not use equality check to check for collection size. -dotnet_diagnostic.xUnit2013.severity = none \ No newline at end of file +dotnet_diagnostic.xUnit2013.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 ce5a2b4843e..e0e3bc08a4c 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