ArgumentNullException.ThrowIfNull
should not be used with non-nullable value, such as int
or bool
.
void Sample(int value, string str)
{
ArgumentNullException.ThrowIfNull(value); // non-compliant as int is not nullable
ArgumentNullException.ThrowIfNull(str); // ok as string is a reference type
}