dotnet / dotnet/dotnet-api-docs

Add more remarks for `Microsoft.Extensions.Configuration` in our docs

Open
#8,549 4 comments 0 reactions 0 assignees View on GitHub
area-Extensions-Configuration Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Comment by @KalleOlaviNiemitalo in https://github.com/dotnet/runtime/issues/43869#issuecomment-1283492310:

---

While implementing [Microsoft.Extensions.Configuration.IConfiguration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration?view=dotnet-plat-ext-7.0), I did not find any documentation on the following:

- Whether the getters and setters are required to be thread-safe. I believe at least the [IConfiguration.Item[String]](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration.item?view=dotnet-plat-ext-7.0) getter is often called by multiple threads without locking.
- Whether [IConfiguration.GetSection(String)](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration.getsection?view=dotnet-plat-ext-7.0) is allowed to create a new configuration section and make it visible in [IConfiguration.GetChildren()](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration.getchildren?view=dotnet-plat-ext-7.0) even if [IConfigurationSection.Value](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfigurationsection.value?view=dotnet-plat-ext-7.0) is not subsequently set.
- Whether [IConfiguration.GetChildren()](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration.getchildren?view=dotnet-plat-ext-7.0).GetEnumerator() is allowed to return an IEnumerator\ 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.