It has been 2 days since we released v2 Core Framework 2.6.0 RTM. This release addresses a compiler ambiguity introduced in 2.6.0.
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
These release notes are a comprehensive list of changes from 2.6.0 to 2.6.1.
With the release of the net6.0
target for xunit.assert
introduced several
compiler ambiguities related to support for ValueTask
. These come about when using
an async lambda to call these functions, as the compiler does not know whether to generate the
lambda to return Task
or ValueTask
(as both are legal). As such, we have
removed/replaced all ValueTask
support.
This includes conversions (for net-new async assertions which are currently ValueTask
only):
Assert.AllAsync<T>(IEnumerable<T>, Func<T, ValueTask>)
toAssert.AllAsync<T>(IEnumerable<T>, Func<T, Task>)
Assert.CollectionAsync<T>(IEnumerable<T>, params Func<T, ValueTask>[])
toAssert.CollectionAsync<T>(IEnumerable<T>, params Func<T, Task>[])
And removals (for new async overloads):
Assert.PropertyChangedAsync(INotifyPropertyChanged, string, Func<ValueTask>)
Assert.RaisesAnyAsync(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>)
Assert.RaisesAnyAsync<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Func<ValueTask>)
Assert.RaisesAsync<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Func<ValueTask>)
Assert.Throws<T>(string?, Func<ValueTask>)
Assert.ThrowsAnyAsync<T>(Func<ValueTask>)
Assert.ThrowsAsync(Type, Func<ValueTask>)
Assert.ThrowsAsync<T>(Func<ValueTask>)
Assert.ThrowsAsync<T>(string?, Func<ValueTask>)
ValueTask
overloads should add .AsTask()
to the end of their ValueTask
returning
code inside the lambda to convert the ValueTask
into a Task
and allow
the code to compile.
xunit/xunit#2808