NServiceBus
NServiceBus copied to clipboard
Roslyn analyzer to prevent dispatching messages incorrectly
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.
That's a good suggestion for cases when you use the marker interfaces. We'll keep this in mind for a future enhancement. Thanks!