Core Framework v3 2.0.1 2025 April 5
Today, we're shipping two new releases:
- xUnit.net Core Framework v3
2.0.1 - xUnit.net Analyzers
1.21.0(release notes)
It's been 5 weeks since the release of 2.0.0.
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
Release Notes
These release notes are a list of changes from 2.0.0 to 2.0.1.
Core Framework
We will no longer emit UTF-8 byte-order marks into reports. This should make the files more compatible with automated tooling (like the GitHub Actions action
github-test-reporter). xunit/xunit#3224We have improved performance for NCrunch users by bypassing expensive JSON serialization and deserialization steps in message reporting, which was exacerbated by the use of synchronous message reporting. xunit/xunit#3228
We have resolved two inconsistencies when calling
IXunitSerializer. First, when using arrays, callingSerializationHelper.Serializewould pass the instance of the array toIXunitSerializer.IsSerializable, butSerializationHelper.IsSerializablewould not. Second, we calledIXunitSerializer.IsSerializabletwice for each element in the array when once was sufficient. xunit/xunit#3243BUG: When generating the entry point for v3 test projects, we failed to normalize the namespace to ensure it was legal. For example, if your project name used characters that weren't legal in a namespace (like a dash:
-) and did not set<DefaultNamespace>in your project file to something legal, we would generate namespaces using the project name, which weren't legal. We now follow the same logic that Microsoft Testing Platform uses for namespace normalization, since we need our generated namespace to match theirs. xunit/xunit#3241BUG: When running in Microsoft Testing Platform mode, any cleanup failure messages were being silently ignored, which caused test projects to pass inappropriately. Now they are reported onto every affected test node (i.e., a test class cleanup failure will be reported as a additional failure of every test in the test class, regardless of what the original state of the test was). xunit/xunit#3213
BUG: We have added support for converting
Trace.AssertandDebug.Assertfailures into test failures. In some scenarios this used to hard-crash the test process. xunit/xunit#3220BUG: We fixed an issue where the randomizer provided by
Randomizer.Currentwas not thread safe. If accessed from multiple threads simultaneously, it could end up returning strings of0instead of random numbers. xunit/xunit#3212BUG: We fixed an issue with
TheoryDatawhere a compiler ambiguity error was thrown if it could not determine whether the data being added was raw data or theory data row data (typically fornullvalues). Note: This utilizesOverloadResolutionPriorityAttributewhich is only recognized by C# 13 (and later) which ships with .NET SDK 9. If you have this compiler ambiguity, either upgrade to the latest .NET SDK or add casts to the data to resolve the ambiguity. xunit/xunit#3197
Assertion Library
We have add a new assertion:
Assert.MultipleAsyncworks the same way asAssert.Multiple, except that the lambdas passed to the assertion areTask-returning (async). xunit/xunit#3209BUG: Fixed an issue with
Assert.Equivalentwhen comparing objects that had replaced properties with thenewkeyboard. xunit/xunit#3193
Runner Utility and Runners
- BUG: We fixed an issue where cleanup failure messages were thrown after finished messages. This made it impossible for developers using
MessageMetadataCacheto acquire metadata information for the cleanup messages, which surfaced in normal use with the first party runnings saying<unknown XYZ>when printing "XYZ" cleanup failure information (i.e.,<unknown test class>forITestClassCleanupFailure). xunit/xunit#3221
NuGet Packages
- The
xunit.v3.assertpackage should no longer include dependencies onSystem.Collections.ImmutableorSystem.Memoryfor users targeting .NET 8+, as the versions included in the framework itself are sufficient.