Code inspection: Nullability conflicts with annotations in hierarchy
This inspection reports a conflict between nullable reference type syntax and JetBrains nullability annotations inherited from the member hierarchy. That means the ? or non-nullable type in the current declaration does not agree with the nullability annotations expected by related base or overridden members.
Example
using JetBrains.Annotations;
class Base
{
[CanBeNull]
public virtual string GetText() => null;
}
class Derived : Base
{
public override string GetText() => "";
}
using JetBrains.Annotations;
class Base
{
[CanBeNull]
public virtual string GetText() => null;
}
class Derived : Base
{
public override string? GetText() => "";
}
Quick-fix
The quick-fix changes the type nullability to match the annotations used in the hierarchy.
01 April 2026