diff --git a/.agents/skills/testing-and-coverage/SKILL.md b/.agents/skills/testing-and-coverage/SKILL.md
index a899cc0a0..ba5542cac 100644
--- a/.agents/skills/testing-and-coverage/SKILL.md
+++ b/.agents/skills/testing-and-coverage/SKILL.md
@@ -30,7 +30,10 @@ Check the csproj files for current versions; this table is from Oct 2026.
Microsoft.CodeAnalysis.Testing 1.1.4 with the framework-neutral `DefaultVerifier`. Don't add test-framework
specific verifier packages (the xUnit flavor was discontinued after 1.1.2). Assertion failures surface as
`InvalidOperationException` with the library's message.
-- Tests are xUnit 2 `[Fact]`/`[Theory]`. Shared data: `Helpers/CommonMemberData.cs`. Settings: pass a
+- Tests are xUnit v3 `[Fact]`/`[Theory]`, with Xunit.Combinatorial v2. Every test project directly references
+ `xunit.v3.mtp-off` and `Microsoft.NET.Test.Sdk` through `Directory.Build.props`, generates an executable
+ entry point, and uses the VSTest adapter (not Microsoft.Testing.Platform). Shared data:
+ `Helpers/CommonMemberData.cs`. Settings: pass a
`stylecop.json` string through the verifier overloads that take `settings`.
## Running tests locally
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1b55b4f76..63a2441c0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -367,6 +367,10 @@ jobs:
name: test-bin-cs${{ matrix.langVersion }}-${{ matrix.configuration }}
path: StyleCop.Analyzers/${{ matrix.project }}/bin/${{ matrix.configuration }}/${{ matrix.framework }}
+ - name: Make test app host executable
+ shell: bash
+ run: chmod +x "StyleCop.Analyzers/${{ matrix.project }}/bin/${{ matrix.configuration }}/${{ matrix.framework }}/${{ matrix.project }}"
+
# The tests allocate heavily on every core; use server GC in the .NET test host.
- name: Run tests
env:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1faebabae..80240e153 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -66,6 +66,12 @@ Use forward slashes in these paths when running from a Linux shell. Add
`--filter "FullyQualifiedName~SA1201"` to select one rule.
Each newer compiler's test project also runs the tests inherited from earlier projects.
+Tests use xUnit v3 and Xunit.Combinatorial v2. Xunit.Combinatorial v2 depends on xUnit v3;
+it cannot be used with the `xunit` v2 package. Every test project is an executable and directly
+references `xunit.v3.mtp-off` so the v3 entry point is generated, including for projects
+which inherit their tests. The MTP-off package preserves the VSTest adapter and Coverlet workflow.
+The same tests continue to target `net10.0` and, on Windows, `net472`.
+
`.gitattributes` checks out test C# sources with CRLF on every platform so multiline
source/expected-output literals match the verifier's explicit CRLF formatting option. Assertions still compare
the exact output; tests for other newline sequences supply them explicitly.
diff --git a/Directory.Packages.props b/Directory.Packages.props
index ddd5d2a8c..054de6988 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -33,8 +33,8 @@
-
-
+
+
diff --git a/StyleCop.Analyzers/Directory.Build.props b/StyleCop.Analyzers/Directory.Build.props
index 4c983c472..d337a1d2a 100644
--- a/StyleCop.Analyzers/Directory.Build.props
+++ b/StyleCop.Analyzers/Directory.Build.props
@@ -23,7 +23,6 @@
-
@@ -31,6 +30,16 @@
true
+
+ Exe
+
+
+
+
+
+
+
+
+
+
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/SymbolNameHelpersUnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/SymbolNameHelpersUnitTests.cs
index d1f0babb8..330ba9296 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/SymbolNameHelpersUnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/HelperTests/SymbolNameHelpersUnitTests.cs
@@ -26,16 +26,18 @@ public class SymbolNameHelpersUnitTests : IAsyncLifetime
private Solution testSolution;
- public async Task InitializeAsync()
+ public async ValueTask InitializeAsync()
{
var compilationOptions = this.GetCompilationOptions();
this.testSolution = await CreateTestSolutionAsync(compilationOptions).ConfigureAwait(false);
}
- public Task DisposeAsync()
+#pragma warning disable AvoidAsyncSuffix // IAsyncDisposable requires this name and returns ValueTask.
+ public ValueTask DisposeAsync()
{
- return Task.FromResult(true);
+ return default;
}
+#pragma warning restore AvoidAsyncSuffix
///
/// Verify the workings of
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/UseCultureAttribute.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/UseCultureAttribute.cs
index 30a9e7030..d3701a76a 100755
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/UseCultureAttribute.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/Helpers/UseCultureAttribute.cs
@@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Test.Helpers
using System.Globalization;
using System.Reflection;
using System.Threading;
- using Xunit.Sdk;
+ using Xunit.v3;
///
/// Apply this attribute to your test method to replace the
@@ -83,7 +83,8 @@ public UseCultureAttribute(string culture, string uiCulture)
/// and replaces them with the new cultures defined in the constructor.
///
/// The method under test.
- public override void Before(MethodInfo methodUnderTest)
+ /// The test being run.
+ public override void Before(MethodInfo methodUnderTest, IXunitTest test)
{
this.originalCulture = Thread.CurrentThread.CurrentCulture;
this.originalUiCulture = Thread.CurrentThread.CurrentUICulture;
@@ -102,7 +103,8 @@ public override void Before(MethodInfo methodUnderTest)
/// to .
///
/// The method under test.
- public override void After(MethodInfo methodUnderTest)
+ /// The test being run.
+ public override void After(MethodInfo methodUnderTest, IXunitTest test)
{
Thread.CurrentThread.CurrentCulture = this.originalCulture;
Thread.CurrentThread.CurrentUICulture = this.originalUiCulture;
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1106UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1106UnitTests.cs
index 04a235864..9f166a20d 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1106UnitTests.cs
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules/SA1106UnitTests.cs
@@ -3,7 +3,6 @@
namespace StyleCop.Analyzers.Test.ReadabilityRules
{
- using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
@@ -22,7 +21,7 @@ public static TheoryData StatementAsBlock
var result = new TheoryData();
foreach (var lineEndingData in CommonData.EndOfLineSequences)
{
- var lineEnding = (string)lineEndingData.Single();
+ var lineEnding = lineEndingData.Data;
result.Add("if (true)", lineEnding);
result.Add("if (true) { } else", lineEnding);
result.Add("for (int i = 0; i < 10; i++)", lineEnding);
diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj b/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
index 85b7f5ef5..423ed5ed4 100644
--- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
+++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj
@@ -21,8 +21,6 @@
-
-