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 isae399e80-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#2884BUG: 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 thetask
keyword to define the async body of the test. xunit/xunit#2892BUG: We fixed an edge case
SystemAccessViolation
that could occur as we were inspecting thrown exceptions, and their properties (likeStackTrace
orMessage
) were in turn throwing. While this violates the contract of theException
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 theLoad
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 forMemory<char>
,ReadOnlyMemory<char>
,Span<char>
, andReadOnlySpan<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 acceptsAction
for attach and detach arguments, in addition to the existingAction<EventHandler>
andAction<EventHandler<T>>
signatures. xunit/xunit#2888We have added additional overloads for
Assert.Raises
,Assert.RaisesAny
,Assert.RaisesAnyAsync
, andAssert.RaisesAsync
which acceptsAction<Action>
andAction<Action<T>>
for attach and detach arguments, to support event handlers which are defined asAction
orAction<T>
rather thanEventHandler
orEventHandler<T>
. xunit/xunit#2900BUG: We fixed an issue for users of the
xunit.assert.source
NuGet package that caused compilation errors when also referencingxunit.core
from duplicate code. xunit/xunit#2889BUG: We fixed an issue with
Assert.Equivalent
not correctly comparingdecimal
values. It was always reporting two decimals values as equivalent regardless of their actual value. xunit/xunit#2913