Table of Contents

Core Framework v3 4.0.0-pre.81 2026 April 11

Today, we're shipping three new prereleases:

  • xUnit.net Core Framework v3 4.0.0-pre.81
  • xUnit.net Analyzers 2.0.0-pre.40 (release notes)
  • xUnit.net Visual Studio adapter 4.0.0-pre.4 (release notes)

This is the second prerelease build for the 4.0 release. This release continues to primarily evolve the Native AOT supports that's new in 4.0, but also includes a few fixes and features for developer using xUnit.net in reflection mode.

As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉

Note

With 4.0, we are discontinuing official support for Microsoft Testing Platform v1. The default version of Microsoft Testing Platform support now is v2 (currently at version 2.2.1), and we will continue to offer packages to turn off Microsoft Testing Platform support as well.

Note

With 4.0, we are discontinuing official support for Mono. While we anticipate that it will usually continue to work, we have noticed occasional Mono-related issues in our own CI process. Given that Mono is now abandoned, we don't anticipate being able to get any support for resolving them. Any requests for xUnit.net support for Mono-related issues will be declined. We may accept bug fixes based on their severity and the impact to the codebase.

Release Notes

These release notes are a list of changes from 4.0.0-pre.33 to 4.0.0-pre.81.

Core Framework

  • We have added the ability to supplement theory method display names with a numeric index to improve lexical sorting of the test names with lots of theory data rows. xunit/xunit#3472

  • We have added several generic versions of attributes:

    • AssemblyFixtureAttribute<TFixture>
    • CollectionBehaviorAttribute<TCollectionFactory>
    • TestCaseOrderAttribute<TOrderer>
    • TestClassOrderAttribute<TOrderer>
    • TestCollectionOrderAttribute<TOrderer>
    • TestFrameworkAttribute<TTestFramework>
    • TestMethodOrderAttribute<TOrderer>
    • TestPipelineStartupAttribute<TPipelineStartup>
    • XunitTestCaseDiscovererAttribute<TDiscoverer>

    These attribute are alternatives to their non-generic counterparts, and only supported on .NET 8+ (as .NET Framework does not support generic attributes, though the compiler will not complain about them). xunit/xunit#3497

  • We have added a new test method display option: RemoveAsyncSuffix. This will remove the word Async from the test method name, if present. xunit/xunit#3520

  • BUG: We've fixed an issue with Native AOT handling with special floating point values (Nan, PositiveInfinity, and NegativeInfinity) that was causing source generation build errors. xunit/xunit#3524

Native AOT

  • For performance reasons, we have moved compiler diagnostics that were previously being reported by the source generators over into analyzers in xunit.analyzers (and in many cases, these diagnostics are now available beyond the scope of just Native AOT).

  • We have moved consumption of TraitAttribute to source generators, and opened up four new registration methods that can be used by third party developers who are creating their own attributes to provide traits:

    • RegisteredEngineConfig.RegisterAssemblyTrait
    • RegisteredEngineConfig.RegisterCodeGenTestClassTrait
    • RegisteredEngineConfig.RegisterCodeGenTestCollectionTrait
    • RegisteredEngineConfig.RegisterCodeGenTestMethodTrait
  • There were a substantial number of additional edge-case bugs related to source generation that have been fixed.

Runners

  • BUG: We fixed an issue where ordering of messages was incorrect during shutdown when a foreground thread was left running. While this was previously fixed the native UX, MTP UX, and dotnet test in MTP mode in 3.2.2, this update now also fixes the issue our first party runners (like xunit.v3.runner.console) and dotnet test in VSTest mode (with the co-released xunit.runner.visualstudio). Note that the issue where test assemblies appear to be pass in this scenario in Test Explorer appears at this point to be unfixable, but at least any command line builds (like CI builds) should fail appropriately. xunit/xunit#3452

Runner Common / Runner Utility

  • We have added several generic versions of attributes:

    • RegisterConsoleResultWriterAttribute<TFixture>
    • RegisterMicrosoftTestingPlatformResultWriterAttribute<TCollectionFactory>
    • RegisterResultWriterAttribute<TOrderer>
    • RegisterRunnerReporterAttribute<TOrderer>

    These attribute are alternatives to their non-generic counterparts, and only supported on .NET 8+ (as .NET Framework does not support generic attributes, though the compiler will not complain about them). xunit/xunit#3497

  • BUG: We have fixed an issue with AssemblyRunner which was causing it to hang indefinitely due to incorrect cancellation handling. xunit/xunit#3522

Microsoft Testing Platform

  • We have removed support for Microsoft Testing Platform v1.

  • The MTP v2 packages have been updated to Microsoft Testing Platform 2.2.1.

  • We have added a new --xunit-list switch to MTP options which is similar to the -list option in the console runner. The implementation has some quirks, so check the issue description for discussion of those. xunit/xunit#3529

  • BUG: Exceptions thrown in ITestPipelineStartup.StopAsync were not being caught, causing issues during cleanup. xunit/xunit#3536