You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
one storing the feature flags, using Microsoft.FeatureManagement
We are calling AddAzureAppConfiguration for both (some application only use the one for configuration, others the one for feature flags).
This ends up in having two instances of the singleton IConfigurationRefresherProvider in the dependency injection provider. This causes issue on our integration tests where we try to replace the first instance.
Hello @MarienMonnier, I don't see a problem with it right now other than figuring out the implementation. The Refreshers object inside AzureAppConfigurationRefresherProvider is only instantiated in the constructor. Because we call AddSingleton, the constructor is called again, updating Refreshers and checking it's valid. If you feel you can address that in your PR (keeping the functionality consistent with how it is now), we can definitely review it. Thanks!
Actually @MarienMonnier I don't think you should need to call AddAzureAppConfiguration(this IServiceCollection services) twice. This can just be called once after all configuration providers are added using the IConfigurationBuilder.AddAzureAppConfiguration method twice, and the AzureAppConfigurationRefresherProvider can discover all of the provider instances at that point.
Sorry for the confusion, let me know if you have more questions or need help restructuring your application.
Hello,
We are using AAC with 2 endpoints:
We are calling AddAzureAppConfiguration for both (some application only use the one for configuration, others the one for feature flags).
This ends up in having two instances of the singleton IConfigurationRefresherProvider in the dependency injection provider. This causes issue on our integration tests where we try to replace the first instance.
Would you accept a change to replace the AddSingleton with TryAddSingleton here?
https://github.com/Azure/AppConfiguration-DotnetProvider/blob/main/src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationExtensions.cs#L99C1-L107C14
If yes, I can propose a Pull Request.
Thanks,
The text was updated successfully, but these errors were encountered: