[Blazor WebAssembly] dotnet watch
may not inject aspnetcore-browser-refresh.js
after dotnet run
#59276
Closed
1 task done
Labels
area-blazor
Includes: Blazor, Razor Components
feature-blazor-wasm
This issue is related to and / or impacts Blazor WebAssembly
feature-hot-reload
This issue is related to the Hot Reload feaature
Milestone
Is there an existing issue for this?
Describe the bug
dotnet watch
may not inject theaspnetcore-browser-refresh.js
script for Blazor WebAssesmbly standalone apps. This is because the cached result ofindex.html
gets used, and this bypasses the script injection middleware.For example, if you run a default Blazor WebAssembly standalone app first using
dotnet run
, then the response forindex.html
will not include the browser refresh script (which is expected). Subsequently runningdotnet watch
will result in that sameindex.html
getting used (without the injected script). Clearing the browser cache results in the script injection middleware re-running, and hot reload will work as expected.Note that:
Expected Behavior
Caching does not interfere with hot reload script injection, and
dotnet watch
works regardless of whetherdotnet run
was executed prior to it.Steps To Reproduce
dotnet new blazorwasm
dotnet run
ctrl+c
)dotnet watch
aspnetcore-browser-refresh.js
script was not injected into the documentaspnetcore-browser-refresh.js
script was injected into the documentExceptions (if any)
No response
.NET Version
9.0.200-preview.0.24529.19
Anything else?
Was also able to repro using .NET SDK version 8.0.404.
Output of dotnet --info
The text was updated successfully, but these errors were encountered: