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

AzureAppConfigurationRefresherProvider doesn't work with .NET 6 ConfigurationManager #279

Closed
pwiens opened this issue Oct 12, 2021 · 4 comments

Comments

@pwiens
Copy link

pwiens commented Oct 12, 2021

In .NET 6 using the new minimal builder style (don't know the name) adding app configuration middleware fails because the IConfigurationRoot in this case is a ChainedConfigurationProvider so it doesn't find any refreshers.

var builder = WebApplication.CreateBuilder(args);

builder.Configuration.AddAzureAppConfiguration(o =>
{
    o.Connect("CONNECTIONSTRING");
    o.ConfigureRefresh(r =>
    {
        r.Register("Sentinel").SetCacheExpiration(TimeSpan.FromSeconds(1));
    });
});

// Add services to the container.

builder.Services.AddAzureAppConfiguration();

builder.Services.AddControllers();
builder.Services.AddSwaggerGen(c =>
{
    c.SwaggerDoc("v1", new() { Title = "MinimalAppConfigExample", Version = "v1" });
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MinimalAppConfigExample v1"));
}

app.UseAzureAppConfiguration();
app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
@avanigupta
Copy link
Member

Similar to #168. The same solution could fix both issues.

@zhenlan
Copy link
Contributor

zhenlan commented Oct 12, 2021

@avanigupta can we open an issue against .NET and request them to open up the underlying providers in ChainedConfigurationProvider?

@avanigupta
Copy link
Member

We already have an open issue in the .NET repo: dotnet/runtime#44486

@avanigupta
Copy link
Member

Hi @pwiens, we found that this issue does not exist in the latest .NET 6 release. The regression was introduced in .NET 6.0.0-rc.1, but it has been fixed now. Can you try the latest bits from Release/6.0.1XX (6.0.x Runtime) and confirm that it works for you?

@zhenlan zhenlan closed this as completed Nov 8, 2021
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

No branches or pull requests

3 participants