Skip to main content
A newer version of this page is available. .
All docs
V22.1

Code Diagnostics

Note

This feature is currently available as a Community Technology Preview (CTP).

The code analysis feature helps you detect C# code errors as you type. If a code analyzer finds rule violations, they are reported in the code editor (as a squiggle under the invalid code) and in the Error List window.

Code Diagnostics Output

Enable Code Diagnostics or Suppress Individual Messages

In Visual Studio, go to “Project | Manage NuGet Packages…” and install the DevExpress.Win.CodeAnalysis package from the local NuGet feed. This analyzer requires Visual Studio 2019 or newer, and supports both .NET Framework and .NET 5+.

Code Diagnostics Analyzer in Visual Studio Solution Explorer

Disable Code Diagnostics

To turn off code analysis, remove the DevExpress.Win.CodeAnalysis NuGet package from your project.

You can suppress warning messages as described in the following Microsoft article: How to suppress code analysis warnings.

Suppress Code Diagnostics Messages

void onGridCustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
    #pragma warning disable DXWIN0002 // Disable warning messages
    RepositoryItemTextEdit edit = new RepositoryItemTextEdit();
    e.RepositoryItem = edit;
    #pragma warning restore DXWIN0002 // Re-enable warning messages
    RepositoryItemTextEdit edit2 = new RepositoryItemTextEdit();
    e.RepositoryItem = edit2;
}