Table of Contents

Core Framework v2 2.7.1 2024 April 11

Today, we're shipping three new releases:

  • xUnit.net Core Framework v2 2.7.1
  • xUnit.net Analyzers 1.12.0 (release notes)
  • xUnit.net Visual Studio adapter 2.5.8 (release notes)

It's been 2 months since the release of 2.7.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 comprehensive list of changes from 2.7.0 to 2.7.1.

Core Framework

  • We have added support for .NET diagnostic events to be reported for the start and finish of individual tests. The event source name is xUnit.TestEventSource, and the provider GUID is ae399e80-45fc-4219-aacc-b73a458ad7e1. Please note that if you are trying to use Concurrency Visualizer that sometimes the start & stop events will not be correctly correlated for async tests, as they may begin and end on different threads. This is unfortunately a limitation of Concurrency Visualizer, though the events should always be present (but not correlated, so marked as diamonds). Please see the linked issue for extensive discussion on this. xunit/xunit#2884

  • BUG: We fixed an issue with the timeout async guard (that is, the code that ensures that you must write an async test to use Timeout on [Fact] or [Theory]) which was inappropriately triggering for F# projects using the task keyword to define the async body of the test. xunit/xunit#2892

  • BUG: We fixed an edge case SystemAccessViolation that could occur as we were inspecting thrown exceptions, and their properties (like StackTrace or Message) were in turn throwing. While this violates the contract of the Exception class, the edge case was seemingly caused by something that was corrupting the exception. Catching and ignoring these exceptions will at least all affected projects to continue to run, albeit with missing information in the exceptions. xunit/xunit#2503

Runner Utility

  • BUG: We fixed an unintentional binary backward compatibility breaking bug with ConfigReader where we added an optional parameter to the Load functions. The old signature has been restored but marked as obsolete and hidden from Intellisense. xunit/xunit#2896

Assertion Library

  • We have updated Assert.Equal overloads for Memory<char>, ReadOnlyMemory<char>, Span<char>, and ReadOnlySpan<char> to more clearly indicate that the values are treated as strings and not individual characters. This is primarily a documentation issue in the API documentation (via XML doc comments), as they have always been treated this way.

  • We have added an additional overload for Assert.Raises which accepts Action for attach and detach arguments, in addition to the existing Action<EventHandler> and Action<EventHandler<T>> signatures. xunit/xunit#2888

  • We have added additional overloads for Assert.Raises, Assert.RaisesAny, Assert.RaisesAnyAsync, and Assert.RaisesAsync which accepts Action<Action> and Action<Action<T>> for attach and detach arguments, to support event handlers which are defined as Action or Action<T> rather than EventHandler or EventHandler<T>. xunit/xunit#2900

  • BUG: We fixed an issue for users of the xunit.assert.source NuGet package that caused compilation errors when also referencing xunit.core from duplicate code. xunit/xunit#2889

  • BUG: We fixed an issue with Assert.Equivalent not correctly comparing decimal values. It was always reporting two decimals values as equivalent regardless of their actual value. xunit/xunit#2913