Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Please get Hot Reload to work reliably and consistently with Blazor WebAssembly, especially with changes to .razor files. This feature seems so buggy when it should "just work". It seems to work much better with non-Blazor server-side changes, e.g. to a Web API, but that's not where much productivity benefit would result.
When using dotnet watch
on my Server project, with verbose logging , I get watch : Hot reload capabilities: .
(not even Baseline) and, on a change, No hot reload changes to apply.
(when there are). This is with .NET 7.0.0 and SDK 7.0.100 on a solution that was created with .NET 6 and recently upgraded to 7.
Starting...
dotnet watch 🔥 Hot reload capabilities: .
dotnet watch ⌚ File changed: .\MySoln\Client\Shared\MainLayout.razor.
dotnet watch ⌚ No deltas modified. Applying changes to clear diagnostics.
dotnet watch ⌚ Received 1 from browser in [Count: 1, MessageType: Binary, EndOfMessage: True].
dotnet watch ⌚ No hot reload changes to apply.
dotnet watch 🔥 Hot reload change handled in 4092.6926ms.
When running from VS (with or without debugging), I get similar output:
, or sometimes instead "Your debugged process might be corrupted and restarting it is recommended nearly always."
The most relevant issue seems to be #40587, but there must be much more to that one that isn't working right.
See also:
- .NET 6 Blazor Hot Reload fails depending on the port specified for the application Url #38029
- Hotreload doesn't work on Blazor wasm (.NET6) #38576
- Hotreload not working with .cshtml files #38809 (title says .cshtml but the same problem happens with .razor)
- CLI Hot reload Blazor wasm just doesn't work. #40587 and Remove various timeouts sdk#27699 (closed without fully fixing)
- [dotnet-watch] Hot reload capabilities are sometimes not reported for blazor-wasm #36723 (closed without fully fixing)
- Blazor WASM Hot Reload cli not working #38561 (closed without fully fixing)
- Document How to Enable Hot Reloading Using dotnet run/watch #38036 (closed without fully fixing)
- https://developercommunity.visualstudio.com/t/blazor-hot-reload-not-working/1480369 (closed without fully fixing)
- Assume basline capabilities sdk#23185 (closed as merged but no notice of what version it is fixed in)
Seems like there are a lot of others struggling too but not commenting in GitHub issues, e.g.
- https://www.reddit.com/r/Blazor/comments/10wwfpr/has_anyone_had_hotreload_randomly_stop_working/
- https://www.reddit.com/r/Blazor/comments/10kishh/blazor_united_prototype_for_from_steve_sanderson/j5r08b4/
- https://www.reddit.com/r/Blazor/comments/vaccxa/hot_reload_is_rubbish/
- https://stackoverflow.com/questions/69778272/unable-to-hot-reload-on-visual-studio-2022/74380447#74380447
- https://stackoverflow.com/questions/70005784/net-6-blazor-wasm-hot-reload-not-working/74750013
- https://learn.microsoft.com/en-us/answers/questions/908804/vs2022-blazor-server-app-hot-reload-notworking
Expected Behavior
dotnet watch
hot reload should just work. I don't want to see "No hot reload changes to apply."- If it isn't working and thus I get "watch : Hot reload capabilities: .", I'd like to see output that tells me why in the verbose output (indeed, perhaps even in warnings).
.NET Version
7.0.0
Anything else?
dotnet --info
.NET SDK:
Version: 7.0.100
Commit: e12b7af219
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.100\
Host:
Version: 7.0.0
Architecture: x64
Commit: d099f075e4
.NET SDKs installed:
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.403 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set