Table of Contents

Core Framework v3 2.0.3 2025 June 7

Today, we're shipping three new releases:

  • xUnit.net Core Framework v3 2.0.3
  • xUnit.net Analyzers 1.22.0 (release notes)
  • xUnit.net Visual Studio adapter 3.1.1 (release notes)

It's been 1 month since the release of 2.0.2.

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.2 to 2.0.3.

Core Framework

  • We have updated [RegisterXunitSerializer] to add a warning message when the developer tries to register a serializer for an array type. The serialization system already natively supports arrays; developers only need to provide serializers for the item type stored in the array. xunit/xunit#3294

  • We have improved the performance of the CecilSourceInformationProvider in several ways:

    • We will only collect source information when instructed to by Microsoft Testing Platform.
    • We have removed instances where Cecil was throwing exceptions unnecessarily.
    • We only load symbols for currently loaded assemblies, then adding symbols for later loaded assemblies dynamically, rather than enumerating all the assemblies in the test folder and gather symbols ahead of time.
    • We are filtering out xUnit.net and Mono assemblies from those whose symbols we load.
    • We fixed an issue where it could sometimes report no source information when hidden lines were involved.
  • We have added a name to TraceAssertOverrideListener (which is responsible for capturing Debug.Assert and Trace.Assert failures and converting them into test failures), to make it easier to remove if needed. The name is xUnit.net. xunit/xunit#3317

  • BUG: We have fixed an issue where TestContext.Current.TestState.Result would not accurately reflect when a passing test has been converted to a failing test due to an exception thrown by BeforeAfterTestAttribute.After. We have also reconciled other related places where the result state was either null or wrong due to exceptions thrown during test class creation, BeforeAfterTestAttribute.Before, and Dispose/DisposeAsync. xunit/xunit#3311

Runner Utility and Runners

  • We have implemented "crash detection" for v3 test projects. Runners should now correctly report the process crash, and be given the correct cleanup messages (either IDiscoveryComplete if the crash occurred during discovery, or ITestAssemblyFinished if the crash occurred during execution).

  • BUG: We fixed a rendering issue with the HTML report which was causing the list of test classes to appear to be progressively indented.

Templates

  • We have added support to the xunit3 and xunit3-extension templates for passing --no-restore to skip the package restore step after unfolding the template. xunit/xunit#3301

Extensibility

  • We have added a new overload to TestRunner. InvokeTestMethod replaces a line of buried code that was calling the reflection invoke of the test method. This allows developers extending the definitions of test cases to provide an alternative mechanism for invoking the test method (including adding any before/after invocation logic). xunit/xunit#3299

  • We have introduced a new interface, ITestProcessWithExitCode, as a supplemental interface that can be implemented when implementing ITestProcess so that the exit code of the process is available. This information is used by the above mentioned crash detection feature to report the exit code of the crashed process.

NuGet Packages

  • The assertion source package (xunit.v3.assert.source) had a few files that were unilaterally marked as public rather than correctly respecting XUNIT_VISIBILITY_INTERNAL, which could cause compiler failures is some situations.