Description
This rule flags the use of a literal parameter name instead of the nameof expression in attributes such as System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute, System.Diagnostics.CodeAnalysis.NotNullWhenAttribute, and System.Runtime.CompilerServices.CallerArgumentExpressionAttribute that take a parameter name.
Example
// Code with violations.
class C
{
void M([NotNullIfNotNull("input")] string? input) { }
}
// Fixed code.
class C
{
void M([NotNullIfNotNull(nameof(input))] string? input) { }
}Your vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0