CLI Hot reload Blazor wasm just doesn't work.
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
There were many issues about dotnet watch not working with blazor wasm. #38561, #36723, #40091 etc. It was mentioned there that the issue is fixed in .net 6.0.2. But it’s not. The issue is there still. Furthermore, there are no responses now on those issues when it was informed that in .net6.0.2 it’s not working. Very disappointing behavior.
dotnet watch --verbose logs
watch : Project supports hot reload and was configured to run with the default run-command. Watching with hot-reload
watch : Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload. Press "Ctrl + R" to restart.
watch : Building...
watch : Started 'C:\Program Files\dotnet\dotnet.exe' '' with process id 9496
Determining projects to restore...
Restored C:\Users\ziaul\Sources\BlazorWasmApp\BlazorWasmApp.csproj (in 1.39 sec).
BlazorWasmApp -> C:\Users\ziaul\Sources\BlazorWasmApp\bin\Debug\net6.0\BlazorWasmApp.dll
BlazorWasmApp (Blazor output) -> C:\Users\ziaul\Sources\BlazorWasmApp\bin\Debug\net6.0\wwwroot
watch : Process id 9496 ran for 27116ms
watch : Running MSBuild target 'GenerateWatchList' on 'C:\Users\ziaul\Sources\BlazorWasmApp\BlazorWasmApp.csproj'
watch : Started 'C:\Program Files\dotnet\dotnet.exe' '' with process id 9176
watch : Process id 9176 ran for 3657ms
watch : Watching 28 file(s) for changes
watch : dotnet-watch is configured to launch a browser on ASP.NET Core application startup.
watch : Configuring the app to use browser-refresh middleware.
watch : Refresh server running at wss://localhost:58192,ws://localhost:58193.
watch : HotReloadProfile: BlazorWebAssembly.
watch : Waiting for a browser to connect
watch : Started 'dotnet' '"C:\Users\ziaul\.nuget\packages\microsoft.aspnetcore.components.webassembly.devserver\6.0.2\build\../tools/blazor-devserver.dll" --applicationpath "C:\Users\ziaul\Sources\BlazorWasmApp\bin\Debug\net6.0\BlazorWasmApp.dll"' with process id 8976
watch : Running dotnet with the following arguments: run
watch : Started
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7020
watch : Launching browser.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5152
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\ziaul\Sources\BlazorWasmApp
watch : Hot reload capabilities: .
watch : File changed: C:\Users\ziaul\Sources\BlazorWasmApp\Pages\Index.razor.
watch : No deltas modified. Applying changes to clear diagnostics.
watch : Received 1 from browser in [Count: 1, MessageType: Binary, EndOfMessage: True].
watch : No hot reload changes to apply.
watch : Hot reload change handled in 6599.4355ms.
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.200
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:24 (8 by maintainers)
Top Results From Across the Web
net 6 blazor wasm hot reload not working
So i've worked out that it only works if you run the project without debugging, not with debugging. Ctrl + F5 (hot reload...
Read more >Hot Reload not so hot. : r/Blazor
I started it through the dotnet watch run command and hot reload worked fine for blazor server and wasm. skill issue maybe?
Read more >NET Hot Reload support for ASP.NET Core
Use .NET Hot Reload to apply code changes to a running app without restarting the app and without losing app state.
Read more >Weird errors problem with dotnet watch with blazor/wasm.
I start the API part with CTRL+F5, and I start the Blazor part from the Windows terminal with dotnet watch (because I want...
Read more >Support .NET6 Hot Reload for Blazor Server ... - YouTrack
Just simple, create a new Blazor Server project. Start it, change something here and there in a component on the razor or code...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I confirm that there is a timeout issue regarding build times.
I’m using intel mac, and I have to close everything, and run the backing api’s in a remote box, because otherwise my machine will get slow, therefore hot-reload not working. Also I have to run dotnet watch twice. The second one is the one that works.
When it works the output is:
dotnet watch 🔥 Hot reload capabilities: Baseline
When it doesn’t
dotnet watch 🔥 Hot reload capabilities: .
Another thing that might affect hot reload working or not, is the boot time of the application. So I set my startup url to a /blank page.
Combining these two things (remote backing api, /blank page) I manage to get hot-reload working.
I would first make sure there are no script load errors / connection errors in the browser web tools. IIRC, I had some issues there because the developer certifcate was not trusted in Firefox. One of the scripts is responsible for the hot reload functionality.
Then use
dotnet watch
instead ofdotnet watch run
.If also not working with cleared bin/obj folders, and verbose output (
dotnet watch -v
) does not print anything useful, my last resort would be to try to build dotnet watch myself and increase the timeout I have linked above. But I don’t know if compiling dotnet watch is easy enough.