docs/articles/nunit-analyzers/NUnit2023.md
| Topic | Value |
|---|---|
| Id | NUnit2023 |
| Severity | Error |
| Enabled | True |
| Category | Assertion |
| Code | NullConstraintUsageAnalyzer |
NullConstraint is allowed only for reference types or nullable value types.
Non-nullable value types cannot have null value, therefore Is.Null assertions will always fail (or will always pass
for Is.Not.Null).
Use suitable constraint.
<!-- start generated config severity -->Configure the severity per project, for more info see MSDN.
# NUnit2023: Invalid NullConstraint usage
dotnet_diagnostic.NUnit2023.severity = chosenSeverity
where chosenSeverity can be one of none, silent, suggestion, warning, or error.
#pragma warning disable NUnit2023 // Invalid NullConstraint usage
Code violating the rule here
#pragma warning restore NUnit2023 // Invalid NullConstraint usage
Or put this at the top of the file to disable all instances.
#pragma warning disable NUnit2023 // Invalid NullConstraint usage
[SuppressMessage][System.Diagnostics.CodeAnalysis.SuppressMessage("Assertion",
"NUnit2023:Invalid NullConstraint usage",
Justification = "Reason...")]