-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-Extensions-Configurationin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Description
This was found as a part of investigating dotnet/aspnetcore#36181. It seems like manually calling IConfigurationRoot.Reload on a chained configuration source doesn't work.
Configuration
var config = new ConfigurationBuilder()
.Add(new RandomConfigurationSource())
.Build();
var config2 = new ConfigurationBuilder()
.AddConfiguration(config)
.Build();
Console.WriteLine(config2["Random"]);
config2.Reload();
Console.WriteLine(config2["Random"]);
public class RandomConfigurationSource : IConfigurationSource
{
public IConfigurationProvider Build(IConfigurationBuilder builder)
{
return new RandomConfigurationProvider();
}
}
public class RandomConfigurationProvider : ConfigurationProvider
{
public override void Load()
{
Data["Random"] = Guid.NewGuid().ToString();
}
}This should print 2 random guids, instead it prints the same guid. If you used a single configuration root (not chained), it would work.
Regression?
Nope
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-Extensions-Configurationin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged