Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Kestrel doesn't seem to be setting the Blazor-Environment header for stand-alone blazor wasm apps in .net 10. It works fine in .net 8 and 9.
Expected Behavior
We expect that kestrel will somehow get the Environment name into the blazor app. The console statement that logs to the browser should show the very same environment that is logged to the host console as kestrel launches.
It seems there should be a Blazor-Environment header on one of the blazor files, but I couldn't find any that had it. In .net 8 and .net 9 for example, blazor.boot.json has this header set on it. In .net 10 preview, I didn't actually see this file at all.
Steps To Reproduce
Using VIsual Studio 2022 or 2022 preview, create a blazor standalone wasm app using the template. Accept the defaults (no auth, etc) to keep it simple.
In Program.cs, after the line:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
Place:
Console.WriteLine($"Client Hosting Environment: {builder.HostEnvironment.Environment}");
Use dotnet run
to launch the app. In all 3 .net versions, it will log to the console:
"info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development"
But when you open your browser and look at its console, this value carried over only in .net 8 and .net 9.
In .net 8 and .net 9 apps, "Development" is logged to the browser console. In .net 10 preview 5 apps, it's "Production" that is logged.
Exceptions (if any)
No response
.NET Version
10.0.100-preview.5.25277.114
Anything else?
No response