Skip to content

Upgrade to NServiceBus 10.2.3#5466

Open
danielmarbach wants to merge 48 commits into
masterfrom
prepare-for-core-upgrade
Open

Upgrade to NServiceBus 10.2.3#5466
danielmarbach wants to merge 48 commits into
masterfrom
prepare-for-core-upgrade

Conversation

@danielmarbach
Copy link
Copy Markdown
Contributor

@danielmarbach danielmarbach commented May 8, 2026

This PR upgrades ServiceControl to NServiceBus 10.2.3 and applies the related modernization required for the 10.2 upgrade.

As part of that work, assembly scanning has been removed/disabled where appropriate, and the required explicit attributes have been added for message handlers and sagas so they continue to be discovered correctly without relying on scanning.

Details

The main focus of this PR is the NServiceBus 10.2.3 upgrade and the corresponding cleanup needed to align ServiceControl with the newer NServiceBus behavior:

  • Upgrades ServiceControl to NServiceBus 10.2.3.
  • Removes reliance on assembly scanning where appropriate.
  • Adds explicit handler attributes for message handlers.
  • Adds explicit saga attributes for sagas.
  • Modernizes endpoint configuration for the NServiceBus 10.2.x model.

Transport tests

The transport tests still require the extension stop logging setup for now because the transports have not yet been moved over to the modern Microsoft.Extensions.Logging integration.

That remaining compatibility layer can be removed once the transports are updated to use the newer logging approach.

Custom checks

As an additional fix, this PR also restores support for custom checks loaded through the transport/plugin context.

Transport-provided custom checks were not being picked up correctly because the primary ServiceControl instance and the transport plugin could end up resolving custom check types from different load contexts. That caused the custom check interface/type checks to fail, so those checks were never registered or executed.

With the changes in this PR, custom checks provided by transports can now be loaded and registered correctly from the plugin context. This means transport-specific checks, including ones that historically did not run, should now work as expected.

@danielmarbach danielmarbach force-pushed the prepare-for-core-upgrade branch 2 times, most recently from 31ed72c to 9282abf Compare May 11, 2026 06:13
@danielmarbach danielmarbach force-pushed the prepare-for-core-upgrade branch 2 times, most recently from b70ac90 to 2979433 Compare May 20, 2026 13:00
@danielmarbach danielmarbach force-pushed the prepare-for-core-upgrade branch from 4bf2d3d to ac6327f Compare May 26, 2026 16:08
@danielmarbach danielmarbach force-pushed the prepare-for-core-upgrade branch from 73b945f to b4c7ca5 Compare May 28, 2026 15:19
@danielmarbach danielmarbach changed the title prepare-for-core-upgrade Upgrade to NServiceBus 10.2.3 May 29, 2026
@danielmarbach
Copy link
Copy Markdown
Contributor Author

I've added Brandon as a reviewer because of the plug-in load context changes. I've also added Mauro and Phil as optional reviewers since they were involved in the original plug-in context work a few years ago.

That said, the reason the custom checks were not being loaded is unrelated to the plug-in load context.

However, the current plug-in load context implementation can introduce type binding mismatches between the service collection and the service provider. Specifically, if a type is loaded first within the transport (as is the case with the custom check in this example) and then registered in the service collection, that type may not be considered identical to the corresponding type loaded by the main application context. This can lead to subtle issues, particularly when resolving collections of services (for example, IEnumerable).

The fact that loading the query providers for the monitoring capability currently works is largely coincidental. In that case, the abstraction lives in ServiceControl and is loaded first, which results in the expected type identities and allows service resolution to succeed.

@danielmarbach danielmarbach marked this pull request as ready for review May 29, 2026 09:42
@danielmarbach
Copy link
Copy Markdown
Contributor Author

There are individual commits so I suggest reviewing them one by one so that you can also skip the cleanup commit! Most of the cleanup commits follow a strict pattern and therefore it should be very easy to skim over them and use the get up already viewed feature to hide the files from the changes

@danielmarbach
Copy link
Copy Markdown
Contributor Author

@bording for you this commit would be relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants