Skip to content

System.Configuration.GetSection(String) returns description is incorrect #10754

Open
@rbennett10

Description

@rbennett10

Describe the issue or suggestion

The current returns description of GetSection() indicates that it returns null. That is incorrect.

The specified ConfigurationSection 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

Metadata

Metadata

Assignees

Labels

Pri3Indicates issues/PRs that are low priorityarea-System.ConfigurationuntriagedNew issue has not been triaged by the area owner

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions