Back to Xunit

Core Framework v2 2.6.1

site/releases/v2/2.6.1.md

latest2.2 KB
Original Source

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.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>) 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 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{ .issue-link }