Skip to content

Conversation

@twsouthwick
Copy link
Member

If someone calls .AddSystemWebAdapters() multiple times in order to add more services to it, it registers the initial services multiple times as well. This is ok, except that the startup filter we use to register middleware will now exist multiple times and will register duplicated features on each invocation

If someone calls `.AddSystemWebAdapters()` multiple times in order to add more services to it, it registers the initial services multiple times as well. This is ok, except that the startup filter we use to register middleware will now exist multiple times and will register duplicated features on each invocation
@twsouthwick twsouthwick added this to the 2.0 milestone Jul 23, 2024
@twsouthwick twsouthwick enabled auto-merge (squash) July 23, 2024 23:16
@twsouthwick twsouthwick changed the title Use Try.. pattern to register services to minimize duplication Use Try... pattern to register services to minimize duplication Jul 24, 2024
@twsouthwick twsouthwick requested a review from joperezr August 6, 2024 22:21
Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, but should we also add a test here that calls this methods multiple times and then ensures that the serviceCollection has the right number of services registered?

@twsouthwick
Copy link
Member Author

Added a test

@twsouthwick twsouthwick requested a review from joperezr August 7, 2024 18:46
@twsouthwick twsouthwick disabled auto-merge August 7, 2024 18:57
@twsouthwick twsouthwick enabled auto-merge (squash) August 7, 2024 22:14
@twsouthwick twsouthwick merged commit 722638c into main Aug 8, 2024
@twsouthwick twsouthwick deleted the multiple-invocations branch August 8, 2024 05:27
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.

3 participants