All docs
V21.2
21.2
21.1
The page you are viewing does not exist in version 21.1. This link will take you to the root page.
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Code Diagnostics (CTP)

  • 2 minutes to read

Note

This feature is currently available as a community technology preview (CTP)

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

xaf code analysis

Note

Code analysis works only with C# code.

Enable Code Analysis

To turn on code analysis, add the DevExpress.ExpressApp.CodeAnalysis NuGet package to all projects in your XAF solution. The Solution Wizard adds this package to newly created .NET 5 projects.

Code analysis requires Visual Studio 2019 for .NET Framework projects.

Disable Code Analysis

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

You can suppress the 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
        // ...
    }
}

Supported Diagnostics