Table of Contents

Analyzers 1.17.0 2024 November 7

Today, we're shipping one new release and two new prereleases:

  • xUnit.net Core Framework v3 0.6.0-pre.7 (release notes)
  • xUnit.net Analyzers 1.17.0
  • xUnit.net Visual Studio adapter 3.0.0-pre.49 (release notes)

It's been 10 weeks since the release of 1.16.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.16.0 to 1.17.0.

Usage Analyzers

  • We have updated xUnit1010 to trigger if your InlineData value is a negative integral value, but the theory parameter is an unsigned integral type. xunit/xunit.analyzers#189

  • We have updated xUnit1045 and xUnit1047 to take usage of [assembly: RegisterXunitSerializer] into account when determining what constitutes a serializable value.

  • BUG: Fixed an issue with xUnit1051 where the fixer was being applied twice in some situations. xunit/xunit.analyzers#190

Assertion Analyzers

  • We have created xUnit2032 to soft-deprecate Assert.IsAssignableFrom and Assert.IsNotAssignableFrom since the names are confusing (based on which of the arguments is the "from" vs. the "to"). Instead, we have created new overloads of Assert.IsType and Assert.IsNotType that accept a new parameter: bool exactMatch. Passing true for this gives the same behavior as using the older overloads; passing false for this gives the same behavior as calling Assert.IsAssignableFrom or Assert.IsNotAssignableFrom. A fixer was added which can convert your "assignable from" calls into "is type" calls with the appropriate flag.

  • We have updated xUnit2018 to not trigger when using the new overloads of Assert.IsType or Assert.IsNotType which allow you pass an exactMatch flag (unless you pass true for the flag, which is identical to the behavior without the flag, and therefore should be triggered). We have updated the fixer so that it will pass exactMatch: false rather than switch you to Assert.IsAssignableFrom or Assert.IsNotAssignableFrom, assuming you're using a version of xUnit.net's assertion library that has the new overload.

Extensibility Analyzers

  • We have updated xUnit3001 to trigger for IRunnerReporter (v3 only) and IXunitSerializer since they both require a parameterless public constructor so that they can be created by the framework. Unlike in other cases, when this constructor is being generated by the fixer, it is not marked as [Obsolete], since it's not used for deserialization; that remains only in place for serializable objects (things that implement IXunitSerializable or are decorated with [JsonTypeID].