Skip to main content

EXMIG0003: using MediatR; directive is swappable

PropertyValue
Diagnostic IDEXMIG0003
TitleMediatR using directive is swappable to the Excalibur.Dispatch compat namespace
CategoryMigration
SeverityInfo
Enabled by defaultYes
Code-fixYes

Cause

The analyzer found a using MediatR; directive. The Excalibur.Dispatch compat surface provides the same MediatR interface shapes in the Excalibur.Dispatch.Compat.MediatR namespace, so the directive can be mechanically swapped to resolve those shapes against the compat package.

Example

- using MediatR;
+ using Excalibur.Dispatch.Compat.MediatR;

How to Fix

Apply the code-fix. It swaps the directive idempotently and does not produce duplicate or orphaned using directives. After referencing the Excalibur.Dispatch.Compat.MediatR package, your existing IRequest/IRequestHandler/INotification/IPipelineBehavior/IStreamRequest code compiles against the compat shapes.

See Migrating from MediatR — swap the namespace.

When to Suppress

Suppress while a file still depends on a MediatR construct that is not part of the compat surface (see EXMIG0002) and you want to keep the original directive until that construct is migrated.

See Also