Table of Contents

Key

Tag Meaning
v2 v2 Supported / not supported for xUnit.net v2 (reflection mode)
v3 v3 Supported / not supported for xUnit.net v3 (reflection mode)
AOT AOT Supported / not supported for xUnit.net v3 (Native AOT mode)
E Analyzer reports as Error by default
W Analyzer reports as Warning by default
I Analyzer reports as Info by default
H Analyzer is hidden by default

Usage Analyzers (1xxx)

ID Title
xUnit1000 v2 v3 AOT E Test classes must be public
xUnit1001 v2 v3 AOT E Fact methods cannot have parameters
xUnit1002 v2 v3 AOT E Test methods cannot have multiple Fact or Theory attributes
xUnit1003 v2 v3 AOT E Theory methods must have test data
xUnit1004 v2 v3 AOT I Test methods should not be skipped
xUnit1005 v2 v3 AOT W Fact methods should not have test data
xUnit1006 v2 v3 AOT W Theory methods should have parameters
xUnit1007 v2 v3 AOT E ClassData must point at a valid class
xUnit1008 v2 v3 AOT W Test data attribute should only be used on a Theory
xUnit1009 v2 v3 AOT E InlineData values must match the number of method parameters
xUnit1010 v2 v3 AOT E The value is not convertible to the method parameter type
xUnit1011 v2 v3 AOT E There is no matching method parameter
xUnit1012 v2 v3 AOT W Null should not be used for value type parameters
xUnit1013 v2 v3 AOT W Public method should be marked as test
xUnit1014 v2 v3 AOT W MemberData should use nameof operator for member name
xUnit1015 v2 v3 AOT E MemberData must reference an existing member
xUnit1016 v2 v3 AOT E MemberData must reference a public member
xUnit1017 v2 v3 AOT E MemberData must reference a static member
xUnit1018 v2 v3 AOT E MemberData must reference a valid member kind
xUnit1019 v2 v3 AOT E MemberData must reference a member providing a valid data type
xUnit1020 v2 v3 AOT E MemberData must reference a property with a getter
xUnit1021 v2 v3 AOT W MemberData should not have parameters if the referenced member is not a method
xUnit1022 v2 v3 AOT E Theory methods cannot have a parameter array
xUnit1023 v2 v3 AOT E Theory methods cannot have default parameter values
xUnit1024 v2 v3 AOT E Test methods cannot have overloads
xUnit1025 v2 v3 AOT W InlineData should be unique within the Theory it belongs to
xUnit1026 v2 v3 AOT W Theory methods should use all of their parameters
xUnit1027 v2 v3 AOT E Collection definition classes must be public
xUnit1028 v2 v3 AOT E Test method must have valid return type
xUnit1029 v2 v3 AOT E Local functions cannot be test functions
xUnit1030 v2 v3 AOT W Do not call ConfigureAwait in test method
xUnit1031 v2 v3 AOT W Do not use blocking task operations in test method
xUnit1032 v2 v3 AOT E Test classes cannot be nested within a generic class
xUnit1033 v2 v3 AOT I Test classes decorated with 'IClassFixture<T>' or 'ICollectionFixture<T>' should add a constructor argument of type 'T'
xUnit1034 v2 v3 AOT W Null should only be used for nullable parameters
xUnit1035 v2 v3 AOT E The value is not convertible to the method parameter type
xUnit1036 v2 v3 AOT E There is no matching method parameter
xUnit1037 v2 v3 AOT E There are fewer theory data type arguments than required by the parameters of the test method
xUnit1038 v2 v3 AOT E There are more theory data type arguments than allowed by the parameters of the test method
xUnit1039 v2 v3 AOT E The type argument to theory data is not compatible with the type of the corresponding test method parameter
xUnit1040 v2 v3 AOT W The type argument to theory data is nullable, while the type of the corresponding test method parameter is not
xUnit1041 v2 v3 AOT W Fixture arguments to test classes must have fixture sources
xUnit1042 v2 v3 AOT I The member referenced by the MemberData attribute returns untyped data rows
xUnit1043 v2 v3 AOT E Constructors on classes derived from FactAttribute must be public when used on test methods
xUnit1044 v2 v3 AOT I Avoid using TheoryData type arguments that are not serializable
xUnit1045 v2 v3 AOT I Avoid using TheoryData type arguments that might not be serializable
xUnit1046 v2 v3 AOT I Avoid using TheoryDataRow arguments that are not serializable
xUnit1047 v2 v3 AOT I Avoid using TheoryDataRow arguments that might not be serializable
xUnit1048 v2 v3 AOT W Avoid using 'async void' for test methods as it is deprecated in xUnit.net v3
xUnit1049 v2 v3 AOT E Do not use 'async void' for test methods as it is no longer supported
xUnit1050 v2 v3 AOT I The class referenced by the ClassData attribute returns untyped data rows
xUnit1051 v2 v3 AOT W Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken
xUnit1052 v2 v3 AOT W Avoid using 'TheoryData<...>' with types that implement 'ITheoryDataRow'
xUnit1053 v2 v3 AOT W The static member used as theory data must be statically initialized
xUnit1054 v2 v3 AOT E Properties used for conditional skipping must be public, static, and return bool
xUnit1055 v2 v3 AOT E Conditional skipping cannot set both SkipUnless and SkipWhen
xUnit1056 v2 v3 AOT E Type must have a single public non-static constructor
xUnit1057 v2 v3 AOT E Type must be public or internal
xUnit1058 v2 v3 AOT E Generic collection definitions are not supported in Native AOT
xUnit1059 v2 v3 AOT W Test classes may not be decorated with ICollectionFixture<>
xUnit1060 v2 v3 AOT E Cultured test methods must have at least one culture
xUnit1061 v2 v3 AOT E Fact methods cannot be generic
xUnit1062 v2 v3 AOT E Theory methods cannot be generic in Native AOT
xUnit1063 v2 v3 AOT E Test class cannot be an open generic type
xUnit1064 v2 v3 AOT E Theory parameter cannot use params modifier in Native AOT
xUnit1065 v2 v3 AOT E MemberData method is ambiguous
xUnit1066 v2 v3 AOT E MemberData parameter cannot use params modifier in Native AOT
xUnit1067 v2 v3 AOT E There is no matching MemberData method argument

Assertion Analyzers (2xxx)

ID Title
xUnit2000 v2 v3 AOT W Constants and literals should be the expected argument
xUnit2001 v2 v3 AOT H Do not use invalid equality check
xUnit2002 v2 v3 AOT W Do not use null check on value type
xUnit2003 v2 v3 AOT W Do not use equality check to test for null value
xUnit2004 v2 v3 AOT W Do not use equality check to test for boolean conditions
xUnit2005 v2 v3 AOT W Do not use identity check on value type
xUnit2006 v2 v3 AOT W Do not use invalid string equality check
xUnit2007 v2 v3 AOT W Do not use typeof expression to check the type
xUnit2008 v2 v3 AOT W Do not use boolean check to match on regular expressions
xUnit2009 v2 v3 AOT W Do not use boolean check to check for substrings
xUnit2010 v2 v3 AOT W Do not use boolean check to check for string equality
xUnit2011 v2 v3 AOT W Do not use empty collection check
xUnit2012 v2 v3 AOT W Do not use Enumerable.Any() to check if a value exists in a collection
xUnit2013 v2 v3 AOT W Do not use equality check to check for collection size.
xUnit2014 v2 v3 AOT E Do not use throws check to check for asynchronously thrown exception
xUnit2015 v2 v3 AOT W Do not use typeof expression to check the exception type
xUnit2016 v2 v3 AOT E Keep precision in the allowed range when asserting equality of doubles or decimals.
xUnit2017 v2 v3 AOT W Do not use Contains() to check if a value exists in a collection
xUnit2018 v2 v3 AOT W Do not compare an object's exact type to an abstract class or interface
xUnit2019 v2 v3 AOT H Do not use obsolete throws check to check for asynchronously thrown exception
xUnit2020 v2 v3 AOT W Do not use always-failing boolean assertion to fail a test
xUnit2021 v2 v3 AOT E Async assertions should be awaited
xUnit2022 v2 v3 AOT I Boolean assertions should not be negated
xUnit2023 v2 v3 AOT I Do not use collection methods for single-item collections
xUnit2024 v2 v3 AOT I Do not use boolean asserts for simple equality tests
xUnit2025 v2 v3 AOT I The boolean assertion statement can be simplified
xUnit2026 v2 v3 AOT W Comparison of sets must be done with IEqualityComparer
xUnit2027 v2 v3 AOT W Comparison of sets to linear containers have undefined results
xUnit2028 v2 v3 AOT W Do not use Assert.Empty or Assert.NotEmpty with problematic types
xUnit2029 v2 v3 AOT W Do not use Assert.Empty to check if a value does not exist in a collection
xUnit2030 v2 v3 AOT W Do not use Assert.NotEmpty to check if a value exists in a collection
xUnit2031 v2 v3 AOT W Do not use Where clause with Assert.Single
xUnit2032 v2 v3 AOT I Type assertions based on 'assignable from' are confusingly named

Extensibility Analyzers (3xxx)

ID Title
xUnit3000 v2 v3 AOT E Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject
xUnit3001 v2 v3 AOT E Classes that are marked as serializable (or created by the test framework at runtime) must have a public parameterless constructor
xUnit3002 v2 v3 AOT W Classes which are JSON serializable should not be tested for their concrete type
xUnit3003 v2 v3 AOT W Classes which extend FactAttribute (directly or indirectly) should provide a public constructor for source information
xUnit3004 v2 v3 AOT E Type must implement appropriate interface
xUnit3005 v2 v3 AOT E Type must have an appropriate non-obsolete public constructor