Code inspection: Suspicious use of variable with discard-like name
This inspection reports assignments or out _ arguments where _ is a real variable, not a discard. This is easy to miss because _ usually looks like a discard. In this case, the code writes into an actual variable instead of intentionally ignoring the value.
Example
class C
{
void M()
{
var _ = 0;
_ = Compute();
}
}
class C
{
void M()
{
var ignored = 0;
_ = Compute();
}
}
Quick-fix
Rename the local variable _ to a different name, or use a discard if it was intended.
01 April 2026