NServiceBus icon indicating copy to clipboard operation
NServiceBus copied to clipboard

Roslyn analyzer to prevent dispatching messages incorrectly

Open SeanFeldman opened this issue 2 years ago • 1 comments

Describe the feature.

Is your feature related to a problem? Please describe.

Publishing events and sending commands is validating at run-time. Having an analyzer to detect that during development time would be very helpful.

Describe the requested feature

When encountering one of these scenarios, e.g.

context.Publish(command);
// or
context.Send(event);

Have the Roslyn analyzer generate an error with a fix to the correct operation.

Additional Context

There are potential complications, such as message conventions.

SeanFeldman avatar Sep 23 '23 18:09 SeanFeldman

That's a good suggestion for cases when you use the marker interfaces. We'll keep this in mind for a future enhancement. Thanks!

kbaley avatar Sep 26 '23 12:09 kbaley