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
{{ message }}
Repository navigation
Add more remarks for Microsoft.Extensions.Configuration in our docs #8549
Whether the getters and setters are required to be thread-safe. I believe at least the IConfiguration.Item[String] getter is often called by multiple threads without locking.
Whether IConfiguration.GetChildren().GetEnumerator() is allowed to return an IEnumerator<IConfigurationSection> that becomes invalid if configuration values are subsequently modified or new sections are created. This relates to thread safety as callers cannot easily lock to protect themselves against such invalidation.
This issue pertains to the IConfiguration interface. The .NET Runtime implements this interface in ConfigurationSection class by delegating to ConfigurationRoot, whose source code can be read to find out how that implementation behaves, but it is not clear whether other implementations have to behave the same way.
A custom implementation of IConfiguration could potentially avoid the performance issue dotnet/runtime#65885 by having a Dictionary<string, IConfigurationSection> children field in each node and making IConfiguration.GetChildren() return the value collection of this dictionary, but this would cause risks related to thread safety and enumerator invalidation. It would be good to document the API contract.
Activity
KalleOlaviNiemitalo commentedon Oct 22, 2022
This issue pertains to the IConfiguration interface. The .NET Runtime implements this interface in ConfigurationSection class by delegating to ConfigurationRoot, whose source code can be read to find out how that implementation behaves, but it is not clear whether other implementations have to behave the same way.
A custom implementation of IConfiguration could potentially avoid the performance issue dotnet/runtime#65885 by having a
Dictionary<string, IConfigurationSection> childrenfield in each node and making IConfiguration.GetChildren() return the value collection of this dictionary, but this would cause risks related to thread safety and enumerator invalidation. It would be good to document the API contract.maryamariyan commentedon Oct 25, 2022
@KalleOlaviNiemitalo would you be interested in improving the
IConfigurationdocumentation by putting up a PR for this?