ReSharper 2026.1 Help

Code inspection: Redundant 'notnull' constraint on type parameter constrained by non-nullable base type

This inspection reports a notnull constraint when another constraint already guarantees that the type parameter cannot be nullable. In that case, the extra notnull does not strengthen the contract.

Example

#nullable enable using System; class C { void M<T>() where T : notnull, IDisposable { } }
#nullable enable using System; class C { void M<T>() where T : IDisposable { } }

Quick-fix

The quick-fix removes the redundant notnull constraint. This usually happens when a non-nullable base type constraint already makes the type parameter non-nullable.

13 April 2026