Skip to content

Fix ChainedConfigurationProvider.Load() to propagate reload to inner IConfigurationRoot#6

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-58683
Closed

Fix ChainedConfigurationProvider.Load() to propagate reload to inner IConfigurationRoot#6
Copilot wants to merge 2 commits intomainfrom
copilot/fix-issue-58683

Conversation

Copy link

Copilot AI commented Mar 3, 2026

ChainedConfigurationProvider.Load() was a no-op, so calling IConfigurationRoot.Reload() on a chained configuration never reloaded the inner root's providers — values stayed stale after an explicit reload.

Description

  • ChainedConfigurationProvider.Load(): now calls Reload() on the inner configuration when it implements IConfigurationRoot; remains a no-op for plain IConfiguration wrappers.
  • Test: ChainedConfiguration_ReloadPropagatestoInnerConfigurationRoot — verifies that a value produced by an inner provider changes after outerConfig.Reload().
var innerConfig = new ConfigurationBuilder()
    .Add(new RandomConfigurationSource())   // generates a new GUID on each Load()
    .Build();

var outerConfig = new ConfigurationBuilder()
    .AddConfiguration(innerConfig)
    .Build();

var before = outerConfig["Random"];
outerConfig.Reload();
var after = outerConfig["Random"];
// before == after  ← was the bug; now before != after

Side-effect to be aware of: an explicit Reload() on the outer root fires its change token twice — once when the inner reload propagates up through the already-registered ChangeToken.OnChange listener, and once from the outer Reload()'s own RaiseChanged(). This is consistent with how automatic (file-watcher) reloads already propagate through chains and is not a data-correctness issue.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pe4vsblobprodcus351.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/runtime/runtime/.dotnet/dotnet dotnet build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…IConfigurationRoot

Co-authored-by: martincostello <1439341+martincostello@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with runtime behavior as described in #58683 Fix ChainedConfigurationProvider.Load() to propagate reload to inner IConfigurationRoot Mar 3, 2026
@martincostello martincostello deleted the copilot/fix-issue-58683 branch March 3, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants