Skip to main content
Any Framework

A Roslyn analyzer to improve the experience when working with nullable reference types.

Published
Oct 26, 2026
17d ago
Total Downloads
2.1M
2,147,154

Install

dotnet add package Nullable.Extended.Analyzer --version 1.18.1

No framework information available.

README

Nullable.Extended.Analyzer

A Roslyn analyzer that warns about every usage of the null-forgiving operator ! that is not justified by a comment, so everyone knows why it is needed. It works in any IDE and on CI.

dotnet add package Nullable.Extended.Analyzer

Justification comments

A justification comment is one or more single line comments directly above the statement or declaration. The first comment line must start with // ! , followed by the justification text:

// ! This is only needed to demo the feature
var text = value1!.ToString();

A code fix is offered that adds the scaffold for the comment.

Diagnostics

Id Context
NX0001 Any other usage of the null-forgiving operator.
NX0002 Null-forgiving operator on the null or default literals at any other statement.
NX0003 Null-forgiving operator inside lambda expressions.
NX0004 Null-forgiving operator on the null or default literals at init only property assignment.

The severity of each category can be configured in your .editorconfig file:

[*.cs]
dotnet_diagnostic.NX0001.severity = error
dotnet_diagnostic.NX0003.severity = suggestion

More

See the project page for the Visual Studio extension, which also detects operators that are no longer needed, and for an MCP server that helps AI assistants to find and fix unjustified operators in large solutions.

Changes from Previous Version

No structural changes between v1.18.0 and v1.18.1.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.