Skip to content

Multiple RegisterOrReplace calls for the same pipeline step identifier throws System.Exception: Step registration with id '<step-identifier>' is already registered for '<step-identifier>'.#7484

Merged
danielmarbach merged 17 commits intomasterfrom
multiple-add-or-replace-steps-fix
Nov 24, 2025

Conversation

@ngallegos ngallegos self-assigned this Nov 18, 2025
@ngallegos ngallegos changed the title Allow multiple calls to RegisterOrReplace on the same pipeline step identifier Multiple RegisterOrReplace calls for the same pipeline step identifier throws System.Exception: Step registration with id '<step-identifier>' is already registered for '<step-identifier>'. Nov 18, 2025
@ngallegos ngallegos marked this pull request as ready for review November 19, 2025 15:31
Comment thread src/NServiceBus.Core.Tests/Pipeline/PipelineModelBuilderTests.cs Outdated
Comment thread src/NServiceBus.Core/Pipeline/PipelineModelBuilder.cs Outdated
Comment thread src/NServiceBus.Core/Pipeline/PipelineModelBuilder.cs Outdated
Comment thread src/NServiceBus.Core.Tests/Pipeline/PipelineModelBuilderTests.cs Outdated
@danielmarbach danielmarbach force-pushed the multiple-add-or-replace-steps-fix branch from 9e9ccb3 to 8b0d2a8 Compare November 24, 2025 07:44
@danielmarbach danielmarbach merged commit ee88832 into master Nov 24, 2025
4 checks passed
@danielmarbach danielmarbach deleted the multiple-add-or-replace-steps-fix branch November 24, 2025 08:00
ngallegos added a commit that referenced this pull request Nov 24, 2025
…r throws System.Exception: Step registration with id '<step-identifier>' is already registered for '<step-identifier>'. (#7484)

* Allow subsequent RegisterOrReplace calls on the same step and take the last that was registered.

* Fixed inaccurate exception message and added test coverage for the PipeLineModelBuilder

* Allow multiple Replace calls on the same step, using the last one

* First small dirty refactoring

* Simplify

* Remove unused code

* Further simplifications and consistently use modifications

* Express fixed order

* Drastically reduce unnecessary allocations and preallocate lists to prevent unnecessary growind and adjusting

* Simplify and remove unnecessary things

* There is really no point in re-inventing the wheel

* Streamline test

* Cleanup line ending

* Modernize

* nullable

* Delete unused code

* Rebase and fix

---------

Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants