Code inspection: Declaration nullability inferred (type member is inferred to be not null)
This inspection reports a method, property, indexer, or operator whose return value is inferred to be never null. The inspection looks at the member body and suggests adding [NotNull] when the code always returns a non-null reference. For async and iterator members, it can suggest item-level annotations such as [ItemNotNull].
Example
In this case, the method always returns a non-null string. The quick-fix suggests annotating the method with the [NotNull] attribute.
public class Settings
{
public string GetName()
{
return "Default";
}
}
using JetBrains.Annotations;
public class Settings
{
[NotNull]
public string GetName()
{
return "Default";
}
}
Quick-fix
Annotate the member with the inferred nullability attribute, usually [NotNull]. For iterators and async methods returning container-like values, the quick-fix can use [ItemNotNull].
28 March 2026