Table of Contents

Core Framework v2 2.8.0 2024 April 27

Today, we're shipping three new releases:

  • xUnit.net Core Framework v2 2.8.0
  • xUnit.net Analyzers 1.13.0 (release notes)
  • xUnit.net Visual Studio adapter 2.8.0 (release notes)

It's been 2 weeks since the release of 2.7.1.

Important

This release has been numbered as 2.8.0 rather than 2.7.2 because it includes an important change to the default behavior of the system with respect to how parallel tests are run. While we don't anticipate this being a problem (and we believe, in fact, that the new system solves a previous problem with accurate timing and [Fact(Timeout = n)] not being reliable when tests were run in parallel), it was still important enough to warrant the version bump.

For more information about this change in parallel algorithms (including how to revert back to the older algorithm, if you so choose), see the Algorithms section of the "Running Tests in Parallel" documentation.

As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. We would especially like to thank Matt Connew for working through the details of the new algorithm. 🎉

Release Notes

These release notes are a comprehensive list of changes from 2.7.1 to 2.8.0.

Core Framework

  • As mentioned above, there is a new default parallelism algorithm. The work for this was done primarily while chasing down deadlock and failing test issues that users were experiencing after upgrading to 2.7.0. Related, we have also rolled back one of the changes that went into 2.7.0: the conditional disabling of the AsyncTestSyncContext. It was discovered that some situations were made worse in terms of deadlocks and test failures when there were no sync contexts in place, because of the overloaded list of tasks that were scheduled, and the sync context was inadvertently releasing some of that pressure. xunit/xunit#2904 xunit/xunit#2912

  • BUG: There was a potential race condition in our assembly lookup cache because of a use of a non-thread-safe dictionary. xunit/visualstudio.xunit#407

  • BUG: There was a bug in our ETW code that send a TestStart event twice rather than a TestStart followed by a TestStop.

Runners

  • The console runner has added a new -useansicolor switch which will force the runner to use ANSI color codes rather than the direct console color system, when running on Windows systems (non-Windows systems always use ANSI colors). This allows users who redirect or capture the output to be able to include colors in their capture. It is important to note that the default CMD or PowerShell windows which are hosted by CONHOST do not support ANSI colors, so you will see the raw ANSI codes; Windows Terminal does correctly display ANSI colors. xunit/xunit#783

Runner Utility

  • We have back-ported from v3 support for a "multiplier" thread count syntax which can be used in command line switches and configuration files. For more information, see the maxParallelThreads section of the configuration file documentation.

  • The default runner reporter will now display /aggressive tacked onto the max thread count (when diagnostic messages are on) when the aggressive parallelism algorithm is enabled.