Skip to main content
All docs
V24.2
.NET 8.0+

Automatic Code Error Diagnostics

  • 3 minutes to read

Code Diagnostics

The code analysis feature helps you detect XAF-specific errors in your code as you type. When 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.

xaf code analysis

Note

Code analysis prerequisites and limitations:

  • Only works with C# code
  • Requires Visual Studio 2019 (or later) if you develop a .NET Framework project

Enable Code Analysis

To turn on code analysis, add the DevExpress.ExpressApp.CodeAnalysis NuGet package to all projects in your XAF solution.

Disable Code Analysis

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

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

code analysis suppress warning

// ...
namespace MySolution.Module.Controllers {
#pragma warning disable XAF0005 // XAF Controller classes should be public
    class MyViewController : ViewController {
#pragma warning restore XAF0005 // XAF Controller classes should be public
        // ...
    }
}

Project Diagnostics

The project analysis feature helps you detect XAF-specific errors in your .NET project. You can find information on rule violations in the Error List window.

Error list with an XAF-specific error

These diagnostics are part of the DevExpress.ExpressApp.Design.NetCorePackage extension. They work when the extension is enabled and ensure the stable operation of the Model Editor.

Supported Diagnostics