Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get rid of call build service provider multiple times during feature flag resolving #103

Merged

Conversation

kamilbaczek
Copy link
Collaborator

@kamilbaczek kamilbaczek commented Mar 27, 2024

🔧 PR Includes:

Fixed feature flag resolving mechanism during startup. The previous version used the build service provider on the main dependency injection container, resulting in dependencies being built multiple times, which caused issues in singleton services. (Reference: https://medium.com/@damien.vandekerckhove/why-you-shouldnt-call-buildserviceprovider-in-net-development-8e25f680d529)

The issue arises when the feature flag is resolved in the ServiceCollection part.

🛠️ Changes Made:

Implemented a new approach that creates a dedicated service provider, which is disposed of right away when the application's dependencies are registered. This new provider only contains dependencies that are used for feature flag resolution, thus isolating it from causing issues in other dependencies.

@kamilbaczek kamilbaczek marked this pull request as draft March 27, 2024 18:16
@kamilbaczek kamilbaczek self-assigned this Mar 27, 2024
@kamilbaczek kamilbaczek marked this pull request as ready for review March 27, 2024 18:37
@kamilbaczek kamilbaczek force-pushed the feature/get_rid_of_call_build_service_provider_multiple_times branch from d6891cb to f89ebac Compare March 28, 2024 17:50
@kamilbaczek kamilbaczek merged commit 7695cc7 into main Mar 28, 2024
4 checks passed
@kamilbaczek kamilbaczek deleted the feature/get_rid_of_call_build_service_provider_multiple_times branch March 28, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants