Skip to main content

Analyzer Diagnostics

Excalibur ships Roslyn analyzers that detect common issues at compile time. These diagnostics appear in your IDE and build output.

Diagnostic Reference

IDTitleSeverityCategory
DISP001Handler Not DiscoverableWarningHandlers
DISP002Missing AutoRegister AttributeInfoHandlers
DISP003Reflection Without AOT AnnotationWarningCompatibility
DISP004Optimization HintInfoPerformance
DISP005Handler Should Be SealedWarningHandlers
DISP006Message Type Missing Dispatch InterfaceWarningHandlers

Migration Diagnostics (EXMIG)

The Excalibur.Dispatch.Migration.Analyzers / Excalibur.Dispatch.Migration.CodeFixes packages ship migration-tooling diagnostics that detect MediatR constructs and offer mechanical code-fixes when porting to the Excalibur.Dispatch.Compat.MediatR shim. The EXMIG#### range does not overlap with DISP###.

IDTitleSeverityCategory
EXMIG0001MediatR registration is portableInfoMigration
EXMIG0002Construct requires a manual migration stepInfoMigration
EXMIG0003using MediatR; directive is swappableInfoMigration
EXMIG0004Handler signature differs from compat shapeWarningMigration

Installation

The analyzers are included automatically when you reference Excalibur.Dispatch.SourceGenerators.Analyzers:

dotnet add package Excalibur.Dispatch.SourceGenerators.Analyzers

Or use the combined source generators package which includes analyzers:

dotnet add package Excalibur.Dispatch.SourceGenerators

Suppressing Diagnostics

To suppress a specific diagnostic, use a #pragma directive:

#pragma warning disable DISP001
// Your code here
#pragma warning restore DISP001

Or suppress project-wide in your .csproj:

<PropertyGroup>
<NoWarn>$(NoWarn);DISP001</NoWarn>
</PropertyGroup>

See Also