diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset index 6db1a743391dd8..12e930144ed207 100644 --- a/eng/CodeAnalysis.ruleset +++ b/eng/CodeAnalysis.ruleset @@ -1,476 +1,496 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/CodeAnalysis.test.ruleset b/eng/CodeAnalysis.test.ruleset new file mode 100644 index 00000000000000..f46a2f8157a8c1 --- /dev/null +++ b/eng/CodeAnalysis.test.ruleset @@ -0,0 +1,546 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 5795f80f3b5f06..7622c28efd0e0a 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -225,7 +225,8 @@ false true - false + false + $(RepositoryEngineeringDir)CodeAnalysis.test.ruleset diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/ConfigurationBinderTests.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/ConfigurationBinderTests.cs index 87db0c9283b7a4..2195e56c596d8a 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/ConfigurationBinderTests.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/ConfigurationBinderTests.cs @@ -845,7 +845,7 @@ public void CanBindByteArrayWhenValueIsNull() var config = configurationBuilder.Build(); var options = config.Get(); - Assert.Equal(null, options.MyByteArray); + Assert.Null(options.MyByteArray); } [Fact] diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderContainerTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderContainerTests.cs index 7de7f6c1559ade..347e4709f18a7a 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderContainerTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceProviderContainerTests.cs @@ -265,7 +265,8 @@ public void ScopeDispose_PreventsServiceResolution() Assert.NotNull(provider.CreateScope()); } - [Theory(Skip = "https://github.com/dotnet/runtime/issues/42160 - We don't support value task services currently")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/42160")] // We don't support value task services currently + [Theory] [InlineData(ServiceLifetime.Transient)] [InlineData(ServiceLifetime.Scoped)] [InlineData(ServiceLifetime.Singleton)] diff --git a/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs b/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs index 6b52654b3a4604..63ea39aa1a93df 100644 --- a/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs +++ b/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs @@ -7,6 +7,8 @@ namespace System.Security.Cryptography.Csp.Tests { public static class CspParametersTests { + public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS")); + const int PROV_RSA_FULL = 1; const int PROV_RSA_AES = 24; @@ -45,7 +47,7 @@ public static void KeyPassword_SetGet() } } - [Theory(Skip = "Manual test - requires Smart Card - read instructions")] + [ConditionalTheory(nameof(ManualTestsEnabled))] // requires Smart Card - read instructions [InlineData(true)] [InlineData(false)] public static void KeyPassword_SmartCard_Manual_Test(bool correctPassword) diff --git a/src/libraries/System.Text.Json/tests/Serialization/NumberHandlingTests.cs b/src/libraries/System.Text.Json/tests/Serialization/NumberHandlingTests.cs index 48ac13e0e6aed9..19afba8251bc3f 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/NumberHandlingTests.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/NumberHandlingTests.cs @@ -817,9 +817,11 @@ static void PerformFloatingPointSerialization(string testString) [InlineData("NaNa")] [InlineData("Infinitya")] [InlineData("-Infinitya")] +#pragma warning disable xUnit1025 // Theory method 'FloatingPointConstants_Fail' on test class 'NumberHandlingTests' has InlineData duplicate(s) [InlineData("\u006EaN")] // "naN" [InlineData("\u0020Inf\u0069ni\u0074y")] // " Infinity" [InlineData("\u002BInf\u0069nity")] // "+Infinity" +#pragma warning restore xUnit1025 public static void FloatingPointConstants_Fail(string testString) { string testStringAsJson = $@"""{testString}""";