Skip to content

AddAzureAppConfiguration - Use TryAddSingleton instead of AddSingleton #611

@MarienMonnier

Description

@MarienMonnier

Hello,

We are using AAC with 2 endpoints:

  • one storing the configuration
  • 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.

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions