Core Framework v2 2.6.1 2023 November 2
Today, we're shipping one new releases:
- xUnit.net Core Framework v2
2.6.1
It's been 2 days since the release of 2.6.0.
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. 🎉
Release Notes
These release notes are a comprehensive list of changes from 2.6.0 to 2.6.1.
Assertion Library
With the release of the
net6.0target forxunit.assertintroduced several compiler ambiguities related to support forValueTask. These come about when using an async lambda to call these functions, as the compiler does not know whether to generate the lambda to returnTaskorValueTask(as both are legal). As such, we have removed/replaced allValueTasksupport.This includes conversions (for net-new async assertions which are currently
ValueTaskonly):Assert.AllAsync<T>(IEnumerable<T>, Func<T, ValueTask>)to
Assert.AllAsync<T>(IEnumerable<T>, Func<T, Task>)Assert.CollectionAsync<T>(IEnumerable<T>, params Func<T, ValueTask>[])to
Assert.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>)
Developers who may now experience compiler failures after utilizing the
ValueTaskoverloads should add.AsTask()to the end of theirValueTaskreturning code inside the lambda to convert theValueTaskinto aTaskand allow the code to compile. xunit/xunit#2808