dotnet / dotnet/dotnet-api-docs
System.Configuration.GetSection(String) returns description is incorrect
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### Describe the issue or suggestion
The current returns description of `GetSection()` indicates that it returns `null`. That is incorrect.
> The specified [ConfigurationSection](https://learn.microsoft.com/en-us/dotnet/api/system.configuration.configurationsection?view=windowsdesktop-9.0) object, or null if the requested section does not exist.
The return type is not marked as nullable in the source code:
https://github.com/dotnet/runtime/blob/main/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/Configuration.cs#L165
`public ConfigurationSection GetSection(string sectionName)`
In the ASP.NET Core docs it correctly states "GetSection never returns null":
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/configuration/index.md?plain=1#L705
> GetSection never returns null. If a matching section isn't found, an empty IConfigurationSection is returned.
The correction should be made here:
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Configuration/Configuration.xml#L356
Contributor guide
Assessment
This issue has not been assessed yet.