-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Extend ConfigurationProvider with Source property and Dispose sources when root is Disposed #100642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note regarding the |
|
|
||
| if (Source.OwnsFileProvider) | ||
| { | ||
| (Source.FileProvider as IDisposable)?.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provider.Dispose does not need to dispose the source anymore, the caller can access ConfigurationSource and do it when needed
|
|
||
| foreach (IConfigurationSource source in _sources) | ||
| { | ||
| (source as IDisposable)?.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the manager has all the sources, so it can just iterate over them and dispose when possible
| // dispose providers and the sources | ||
| foreach (IConfigurationProvider provider in _providers) | ||
| { | ||
| (provider.ConfigurationSource as IDisposable)?.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the root has no reference sources, but it can now access provider.ConfigurationSource and dispose when possible
An alternative for #100641 to fix #95745. It requires new public APIs and is a breaking change. Please see my comments