Core Framework v3 4.0.0-pre.33 2026 March 25
Today, we're shipping three new prereleases:
- xUnit.net Core Framework v3
4.0.0-pre.33 - xUnit.net Analyzers
2.0.0-pre.9(release notes) - xUnit.net Visual Studio adapter
4.0.0-pre.3(release notes)
This is the first prerelease build for the 4.0 release. The big new feature in this release is support for Native AOT test projects, which will allow developers testing their Native AOT code to run it in the Native AOT environment, including support for publishing your test projects to Native AOT for the most complete test environment.
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 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 3.2.2 to 4.0.0-pre.33.
Core Framework
Version 4.0 introduces support for Native AOT. For more information on how to use Native AOT and the difference between Native AOT and the traditional reflection-based version of xUnit.net, please see Testing with Native AOT.
We have introduced test class and test method orderers (in addition to the existing test collection and test case orderers). Ordering is performed as collection => class => method => case. xunit/xunit#3424
We have added
ITestMetadata.TestLabel, makingLabelfrom data attributes available via metadata andTestContext.Current.Test.TestLabel. xunit/xunit#3388
Assertions
We have added an overload to
Assert.AllandAssert.AllAsyncwith a booleanstrictparameter. When this isfalse, it behaves like the original version; when it'strue, the assertion will fail if the collection is empty. xunit/xunit#3476BUG: We have fixed an issue with the assert.xunit repository when used as a Git submodule to no longer depend on a source file (
EnvironmentVariables.cs) from the main project. xunit/xunit#3511BUG: We have fixed an issue where
AssertEqualityComparer.GetDefaultComparer()andAssertEqualityComparer.GetDefaultInnerComparer()could throwNullReferenceExceptionon Mono due to improper circular initialization logic. xunit/assert.xunit#73
Runners
Version 4.0 introduces the xUnit.net native console runner as a .NET Tool. Install this tool with
dotnet tool install -g --prerelease xunit-console-tooland run it withdotnet xunit-console. It contains thexunit.v3.runner.consolebinary, with builds supporting Linux (32-bit Arm, 64-bit Arm, and 64-bit Intel/AMD), macOS (64-bit Arm and 64-bit Intel/AMD), and Windows (64-bit Arm, 64-bit Intel/AMD, and 32-bit Intel/AMD). Installing this requires you are using .NET 10 SDK or later.The
-list fulloutput (for console runners) now includes an indication when tests are marked as explicit. xunit/xunit#3502
Microsoft Testing Platform
The default version of Microsoft Testing Platform is now v2 rather than v1. We are considering removing support for v1 entirely; please respond to the poll on our Mastodon account if you believe you would be negatively affected by this removal.
We have updated the default file extensions for three of the reports, so that they are more useful when auto-generating the file name:
- JUnit report, changed from
.junitto.junit.xml - NUnit report, changed from
.nunitto.nunit.xml - xUnit.net v2 report, changed from
.xunitto.xunit.xml
This should make it easier to open and inspect these default report files. xunit/xunit#3498
- JUnit report, changed from
The MTP v2 packages have been updated to Microsoft Testing Platform 2.1.0. xunit/xunit#3510
Extensibility
We have added
StartTimeandFinishTimeon the major pipeline events viaIStartedMessageandIFinishedMessage. This should mean every starting or finished message now includes the UTC start or finish time associated with the event.The result reports (HTML, XML, etc.) have been converted from XSL-T to custom code, to support Native AOT. Developers can now implement the appropriate interfaces (
IConsoleResultWriterandIMicrosoftTestingPlatformResultWriter) and register them via assembly-level attributes ([RegisterConsoleResultWriter],[RegisterMicrosoftTestingPlatformResultWriter], as well as[RegisterResultWriter]which can be used for a result writer which supports both (all the built-in writers support both, except for xUnit.net v1 XML, which we consider a deprecated holdover and no longer appropriate for MTP).
Obsolete APIs removed
We have removed the following APIs that were marked obsolete during 3.x:
CecilSourceinformationProviderhas been replaced by compiler-provided arguments toFactAttributeExecutionErrorTestCase ctorwithoutsourceFilePathandsourceLineNumberFixtureMappingManager.InitializeAsync()withoutcreateInstancesTestIntrospectionHelper.GetTestCaseDetails()withoutlabelXunit3ArgumentFactory.ForRun()withouttestCaseIDsXunitTestClassRunnerBase.FormatConstructorArgsMissingMessage(no longer called)XunitTestCollectionRunnerBase.GetTestCaseOrderer(newly introduced test class runner takes precedence)XunitTestMethod.GetDisplayName()withoutlabel- The classes in namespace
Xunit.Runnershave been removed (in favor of the classes inXunit.SimpleRunner)