You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since all handled message types are mapped through the base interface, this should be a perfectly fine saga definition. With NSB 7, sagas like this was not a problem (we have them running in production).
Actual behavior
When upgrading to NSB 8, the analyzer starts to throw error NSB0006 (which I believe is a false positive):
ReproSaga.cs(7, 5): [NSB0006] Saga ReproSaga implements IAmStartedByMessages<IFirstMessage> but does not provide a mapping for that message type. In the ConfigureHowToFindSaga method, after calling mapper.MapSaga(saga => saga.CorrelationPropertyName), add .ToMessage<IFirstMessage>(msg => msg.PropertyName) to map a message property to the saga correlation ID, or .ToMessageHeader<IFirstMessage>("HeaderName") to map a header value that will contain the correlation ID.
Versions
NServiceBus 8.0.3
Steps to reproduce
Reference NServiceBus 8
Take the code block above and build
Analyzer generates error
Relevant log output
No response
Additional Information
Workarounds
Using explicit mapping of all message types seems to satisfy the analyzer.
Possible solutions
Additional information
Since the analyzer rule is an error and not a warning, we cannot suppress it with for example <NoWarn>.
The text was updated successfully, but these errors were encountered:
You're absolutely right. I was convinced that only warnings could be suppressed, not errors - but apparently not. Both #pragma warning disable in code and <NoWarn> in csproj works fine. I didn't try modifying the .editorconfig file but that probably also works.
DavidBoike
changed the title
Saga analyzer rule NSB0006 gives false positive when mapping is done with base interface
Analyzer rule NSB0006 gives false positive when mapping is done with base interface
Jun 16, 2023
Describe the bug
Description
Consider the following saga and message definitions:
Expected behavior
Since all handled message types are mapped through the base interface, this should be a perfectly fine saga definition. With NSB 7, sagas like this was not a problem (we have them running in production).
Actual behavior
When upgrading to NSB 8, the analyzer starts to throw error NSB0006 (which I believe is a false positive):
Versions
NServiceBus 8.0.3
Steps to reproduce
Relevant log output
No response
Additional Information
Workarounds
Using explicit mapping of all message types seems to satisfy the analyzer.
Possible solutions
Additional information
Since the analyzer rule is an error and not a warning, we cannot suppress it with for example
<NoWarn>
.The text was updated successfully, but these errors were encountered: