[release/6.0] Load IConfigurationProviders once in WebApplicationBuilder #37040
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.
Backport of #37039 to release/6.0
/cc @halter73
Customer Impact
This PR addresses two major issues:
Given config sources that can only be loaded once (such as those backed by
Stream),WebApplicationBuilder.Build()throws anInvalidOperationException.Changes to configuration sources after build are not observed. This means that if
appsettings.jsonis modified from:{ "Logging": { "LogLevel": { "Default": "Warning" } } }to:
{ "Logging": { "LogLevel": { "Default": "Debug" } } }while the application is running, only logs with severity warning and higher will be logged until the application is restarted.
After this change, a file change notification correctly updates the default log level to
Debugand debug-level logs are emitted immediately.Regression
The inability to notice configuration source changes was a regression between rc1 and rc2.
Testing
Manual testing. Added both end-to-end and unit regression tests.
Risk
Low. This change has undergone significant testing and review.