Skip to content

Send-only endpoints can incorrectly activate saga features when saga assemblies are scanned#7783

Merged
DavidBoike merged 1 commit into
masterfrom
sagas-prerequisite
May 28, 2026
Merged

Send-only endpoints can incorrectly activate saga features when saga assemblies are scanned#7783
DavidBoike merged 1 commit into
masterfrom
sagas-prerequisite

Conversation

@danielmarbach
Copy link
Copy Markdown
Contributor

@danielmarbach danielmarbach commented May 28, 2026

The feature prerequisite in https://github.com/Particular/NServiceBus/blob/release-10.0/src/NServiceBus.Core/Sagas/Sagas.cs#L25C9-L25C153 includes a check for send-only endpoints. As part of #7609, we moved the send-only check into the saga component itself, assuming that send-only endpoints would never contain sagas and therefore the feature prerequisite would prevent the feature from being enabled.

The problem is that if a send-only endpoint has any assemblies containing sagas available during assembly scanning, saga metadata can still be discovered. This causes the saga feature to become active, along with any features depending on it.

In the case of the SagaAudit feature, this resulted in a crash because ReceiveAddresses are not available in send-only endpoints:
https://github.com/Particular/NServiceBus.SagaAudit/blob/master/src/NServiceBus.SagaAudit/SagaAuditFeature.cs#L25

Needs to be backported to 10.1.x and 10.2.x

Symptoms

An error is raised at startup due to a missing service ReceiveAddresses in the dependency injection container.

Who's affected

Users are only affected when saga auditing is enabled on a send-only endpoint that also has saga code included (whether via assemblys canning or manually registered) which commonly through use of the NServiceBus.ServicePlatform.Connector plugin. This is a very uncommon configuration.

Root cause

A regression in feature registration code starting in version 10.1.0.

…d-only endpoint so just checking saga metadata is not sufficient.
@danielmarbach danielmarbach marked this pull request as ready for review May 28, 2026 14:42
@danielmarbach danielmarbach changed the title SagaMetadataCollection can have sagas found by scanning even on a send-only endpoint so just checking saga metadata is not sufficient. Send-only endpoints can incorrectly activate saga features when saga assemblies are scanned May 28, 2026
@DavidBoike DavidBoike merged commit dcb6939 into master May 28, 2026
4 checks passed
@DavidBoike DavidBoike deleted the sagas-prerequisite branch May 28, 2026 16:22
@DavidBoike DavidBoike added the Bug label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants