Analyzers 1.9.0 2024 January 4
Today, we're shipping two new releases:
- xUnit.net Core Framework v2
2.6.5(release notes) - xUnit.net Analyzers
1.9.0
It's been 2 weeks since the release of 1.8.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 1.8.0 to 1.9.0.
Usage Analyzers
BUG: We fixed an issue in xUnit1030 that was raising a diagnostic inappropriately for using
ConfigureAwaitinside of a lambda expression. xunit/xunit.analyzers#177BUG: We fixed an issue in xUnit1031 that was raising a diagnostic inappropriately for code using blocking
Taskmethods inside of a lambda expression. xunit/xunit#2856BUG: We fixed an issue in xUnit1034 that was misidentifying array initializers in
[InlineData]as beingnull. xunit/xunit#2852
Assertion Analyzers
Added xUnit2026 to detect when developers called
Assert.EqualorAssert.NotEqualwith two sets, using the function overload for comparisons. Due to the way sets are implemented internally, a full implementation ofIEqualityComparer<T>is required, because the implementations ofEqualsandGetHashCodemust be consistent (so just passing the equivalent ofEqualsas a function is not sufficient for proper comparisons). xunit/xunit#2840Added xUnit2027 to detect when developers called
Assert.EqualorAssert.NotEqualwith a set (likeHashSet) and a linear collection (like an array or list). Since sets are not stored in linear fashion, they have an unpredictable enumeration order, which can cause false positives or false negatives during testing. Applying an order to the set (for example, using LINQ'sOrderByextension method) ensures that the set becomes linear with a predictable order.