[release/6.0] Fix diff checks for ContentRoot and WebRoot #41182
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.
Prevent unnecessary startup errors in WebApplicationBuilder
Without this fix, when a
wwwroot
directory exists, calling thebuilder.WebHost.ConfigureAppConfiguration()
method throws aNotSupportedException
error thinking the web root directory (wwwroot
by default) was modified when it wasn't.Description
Backport of #40095. #38212 (comment) brought this back to my attention.
Customer Impact
Normally we'd tell customers to use
builder.Configuration
instead ofbuilder.WebHost.ConfigureAppConfiguration()
, butbuilder.WebHost
is anIWebHostBuilder
adapter for many extension methods like.UseStaticWebAssets()
.This bug causes
.UseStaticWebAssets()
and just about any other method callingConfigureAppConfiguration()
to throw aNotSupportedException
when it shouldn't. There is a workaround, but it's hard to discover and shouldn't be necessary.Fixes #39546 and #38212
Regression?
Risk
This change has automated tests and was fixed in 7.0-preview2 and verified by customers.
Verification
Packaging changes reviewed?