Code inspection: Conditional access qualifier expression is known to be null or not null
This inspection reports a conditional access expression when the qualifier is already known at that exact program point. In practice, the analyzer has proved that the qualifier is definitely non-null or definitely null, so ?. no longer expresses a real condition.
This most often happens after control-flow has already established the value is non-null, or when ?. is used on a non-nullable value type result.
When the qualifier is definitely null, the whole conditional access is effectively dead code and should usually be rewritten or removed.
if (text != null)
{
int length = text?.Length ?? 0;
}
if (text != null)
{
int length = text.Length;
}
13 April 2026