aspnetcore: CLI Hot reload Blazor wasm just doesn't work.

Is 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 24 (8 by maintainers)

Most upvoted 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 of dotnet 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.

Me too, sometimes I get “Hot reload capabilities: Baseline.” (hot reload works) and other times I get “Hot reload capabilities: .” (hot reload does not work).

Occasionally it helps to delete all build artifacts and rebuild everything. However, if it is really a build time issue as @ziaulhasanhamim suggested, deleting the build artifacts should make it worse … its confusing and quite annoying 😦

Edit: I am working under Kubuntu 22.04 using vscode.

I am experiencing this too. “No hot reload changes to apply.” is very wrong. It is so close, it just needs to apply the changes to my .razor file, push the new client code etc.

Thanks for contacting us. We’re moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. Because it’s not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it’s very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Open question? What is the question? And why author feedback was added? What feedback do I need to provide?