Back to Devexpress

Code Diagnostics

windowsforms-403879-build-an-application-security-considerations-code-diagnostics.md

latest1.8 KB
Original Source

Code Diagnostics

  • Feb 23, 2024

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.

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+.

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.

csharp
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;
}