razor: .NET 8 Preview 4 - Blazor WASM - Hot Reload broken with dotnet watch

Describe the bug

  • Static Blazor WASM client.
  • .NET 8 preview 4

Hot Reload isn’t usable anymore.

After every (saved) change in a .razor page the dotnet watch cli reports the following error:

dotnet watch ⌚ File changed: .\Pages\Txt2Img.razor.
dotnet watch ⌚ C:\X\Repos\Tusk\ClientTusk\Program.cs(10,28): error CS0246: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
dotnet watch ⌚ Found compilation errors during hot reload. Reporting it in application UI.

If you do CTRL-R (restart) everything works again. Without an additional change.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 9
  • Comments: 18 (11 by maintainers)

Most upvoted comments

I am getting the same issue with a blazor WASM app, however not running .NET 8 previews. I am using .NET 7

dotnet --version
7.0.203

I have the same issue with 7.0.302, It’s a very frustrating problem when using Blazor Wasm professionally and every day!

I can confirm the exact same bug

This should be fixed by later .NET previews. Please comment here if that’s not the observed case. Thanks!

Have downloaded .NET SDK 8.0.100-preview.6 and given it a go, unfortunately same issue still exists for me. Updating a random file, will trigger the hot reload, it will fail to build on the hot reload, but Ctrl+R will rebuild and rerun it just fine. WindowsTerminal_542f8c5e-cdc2-48e4-8b1f-8ff0ec95233f

I am getting the same issue with a blazor WASM app, however not running .NET 8 previews. I am using .NET 7

dotnet --version
7.0.203