-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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 dotnet watch (and in VS Pro debugging) 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, on a change, I always get No hot reload changes to apply.
in .NET 7 and "No changes applied to client because they are not supported by the runtime." in .NET 8 RC2. This is on a solution that was created with .NET 6 and upgraded to 7 then 8.
The following issues were closed without fixing the issue: 47836 and The earlier issue 45519, which has links to many other similar issues too, but I will avoid repeating them here.
So @danroth27 reached out on Twitter so I thought I would try again with this one. Please help fix!
Expected Behavior
If I get "No hot reload changes to apply.", please tell me why. It sees a file change but doesn't see changes to apply--why not??? Even in verbose mode, I get no clues.
But really, I just want hot reload to work as designed. I expect to see dotnet watch ⌚ File changed: .\TradeCars\Client\Pages\Index.razor.
and then the new page is injected and the DOM/other updates happen live in my browser--or it is a rude edit and dotnet-watch rebuilds and reloads. Not getting either right now.
Steps To Reproduce
Sample repo for .NET 7 and a branch for .NET 8 RC2
To reproduce, run exactly as follows
git clone https://github.com/szalapski/HotReloadIssue45519Demo
cd .\HotReloadIssue45519Demo\
dotnet watch --project ./TradeCars/Server
I got a lot of irrelevant info output, but after I edit Index.razor and save it, I get:
dotnet watch ⌚ File changed: .\TradeCars\Client\Pages\Index.razor.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 POST https://localhost:5008/_framework/blazor-hotreload application/json 2
dotnet watch ⌚ No hot reload changes to apply.
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/2 POST https://localhost:5008/_framework/blazor-hotreload application/json 2 - 2
I have .NET SDK 7.0.403 running on Windows 10. @tmat said he could not reproduce even with the above repo--if that is still the case, there must be something different about our environments; will you help me figure it out? What could be different in your run? What output do you see? This is plaguing my whole team and preventing further adoption of Blazor at my large company.
I tried it with SDK 8.0.100-rc.2.23502.2 (in other branch - git switch dotnet8
) and target framework net8.0, and got:
dotnet watch ⌚ File changed: .\TradeCars\Client\Pages\Index.razor.
dotnet watch ⌚ No changes applied to client because they are not supported by the runtime.
dotnet watch ⌚ Received successful apply from delta applier.
dotnet watch 🔥 Hot reload of changes succeeded.
dotnet watch ⌚ Refreshing browser.
dotnet watch 🔥 Hot reload change handled in 865.0203ms.
Though it seemed more promising at first glance, there is no net change even though the dotnet-watch console message changed and it still doesn't work for the simplest of changes. "They are not supported by the runtime"? Why?
.NET Version
7.0.403 and 8.0.100-rc.2.23502.2