[release/9.0-rc2] [Blazor] Update WebAssembly.DevServer
to serve the Blazor-Environment
header
#57974
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 #57971 to release/9.0-rc2
/cc @MackinnonBuck
[Blazor] Update
WebAssembly.DevServer
to serve theBlazor-Environment
headerFixes a recent regression that caused Blazor WebAssembly Standalone apps to always interpret the ASP.NET Core environment as "Production" during development.
Description
Blazor WebAssembly apps determine the ASP.NET Core environment by reading the
Blazor-Environment
header in the response for the boot manifest (blazor.boot.json
). A recent change caused the WebAssembly development server to stop serving this header, which resulted inIWebAssemblyHostEnvironment.Environment
always returning"Production"
. This PR fixes the issue by updating the development server to correctly serve the header.Fixes #57941
Customer Impact
Without this fix, customers relying on
IWebAssemblyHostEnvironment
to selectively enable features based on the environment will experience problems during development. They will need to find another solution to determine whether the app is running in a development environment.Regression?
Regressed in .NET 9 Preview 6
Risk
The fix is straightforward, and automated tests now validate the expected behavior.
Verification
Packaging changes reviewed?