Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,20 @@ internal static bool TryGetConfiguration(this IConfigurationRoot root, string ke
for (int i = providers.Count - 1; i >= 0; i--)
{
IConfigurationProvider provider = providers[i];
if (provider.TryGet(key, out value))

try
{
if (provider.TryGet(key, out value))
{
return true;
}
}
catch (ObjectDisposedException)
{
return true;
// Skip disposed providers to avoid exceptions during access.
// This is especially relevant for cases like ConfigurationManager,
// which implements IConfigurationRoot and may mutate the providers
// collection and dispose replaced providers.
}
}

Expand Down
Loading