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
Configuration collections currently return null for any key containing /, which hides real configuration errors when a slash-containing section/group name is actually declared. This change keeps descendant-path rejection (outer/inner) while allowing exact slash-named keys present in the collection to flow to normal factory resolution and surface cached ConfigurationErrorsException.
Lookup guard refinement (section groups)
ConfigurationSectionGroupCollection.Get(string) now rejects slash paths only when the key is not an exact member of the collection.
Lookup guard refinement (sections)
Applied the same logic in ConfigurationSectionCollection.Get(string) for parity.
Regression coverage
Added tests for:
name lookup and index lookup
enumeration behavior
CopyTo
descendant-path rejection preservation
// before: any slash was rejectedif(name.Contains('/'))returnnull;// after: reject only slash paths that are not exact keys in this collectionif(name.Contains('/')&&BaseGet(name)isnull)returnnull;
Customer Impact
Without this fix, malformed slash-named declarations can be silently surfaced as null entries instead of the expected configuration exception, obscuring configuration failures and making diagnosis harder.
Regression
Yes. This addresses incorrect handling where slash-containing declared names were treated the same as descendant-path access.
Low. Change is narrowly scoped to key filtering in two collection getters and is covered by targeted behavioral tests for both corrected and preserved paths.
Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
Note
This PR description was generated with AI/Copilot assistance.
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
CopilotAI
linked an issue
Aug 11, 2026
that may be
closed
by this pull request
CopilotAI
changed the title
[WIP] Fix ConfigurationManager handling of sectionGroup names with '/'ConfigurationManager: preserve descendant-path guard while honoring slash-named entriesAug 12, 2026
The comment above this guard is now misleading: the code no longer rejects all names containing '/', it only rejects slash-containing names that are not exact members of this collection. Updating the comment will help future maintainers understand why BaseGet(name) is part of the check.
// prevent GetConfig from returning config not in this collection
if (name.Contains('/') && BaseGet(name) is null)
return null;
The comment above this guard is now misleading: the code no longer rejects all names containing '/', it only rejects slash-containing names that are not exact members of this collection. Updating the comment will help clarify why BaseGet(name) is used.
// prevent GetConfig from returning config not in this collection
if (name.Contains('/') && BaseGet(name) is null)
return null;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
main PR N/A
Description
Configuration collections currently return
nullfor any key containing/, which hides real configuration errors when a slash-containing section/group name is actually declared. This change keeps descendant-path rejection (outer/inner) while allowing exact slash-named keys present in the collection to flow to normal factory resolution and surface cachedConfigurationErrorsException.Lookup guard refinement (section groups)
ConfigurationSectionGroupCollection.Get(string)now rejects slash paths only when the key is not an exact member of the collection.Lookup guard refinement (sections)
ConfigurationSectionCollection.Get(string)for parity.Regression coverage
CopyToCustomer Impact
Without this fix, malformed slash-named declarations can be silently surfaced as
nullentries instead of the expected configuration exception, obscuring configuration failures and making diagnosis harder.Regression
Yes. This addresses incorrect handling where slash-containing declared names were treated the same as descendant-path access.
Testing
Added focused regression tests covering slash-name name/index access, enumeration,
CopyTo, and descendant-path rejection behavior.Risk
Low. Change is narrowly scoped to key filtering in two collection getters and is covered by targeted behavioral tests for both corrected and preserved paths.
Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
Note
This PR description was generated with AI/Copilot assistance.