-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot Reload with dotnet-watch and Blazor WebAssembly fails on simple markup .razor changes with "No hot reload changes to apply." in .NET 7 and "not supported by the runtime" in .NET 8 RC2. #51781
Comments
Do you get something like |
What I found out is that if I only have Firefox to view the Blazor WASM project, Hot Reload no matter if I get the cert trusted or not. However, if I can open Chromium to open the project first (thus register |
@MakiseKurisu, I tried it with both Firefox and Google Chrome just to be sure and both match the behavior I cite above, with no "can’t establish a connection to the server" message at all. Indeed, the browser properly has a connection to the server, as I have seen the grey check popover, yet the hot "re-compile" (or partial recompile with injection) didn't happen, so the browser never shows the change, per the above. Care to try it with my repo and see what you get, per the instructions above? |
I have nothing but problems with hot reload and .net 8 hasn't fixed that for me. I end up having to stop start my projects which is so tedius because they're large and can take a couple seconds to compile/startup etc and then navigate back to where I was... I've tried dotnet watch and visual studio. It seems to work for css and js files but it seems to not work razor files at all, even if all I change is just html. I saw the previous thread that @szalapski had started and I really can't upvote this enough. |
Would you be willing to try my repo according to the short instructions I gave above? I'm curious if you could get a different outcome from me. |
I tried the repro and it didn't work for me either (the .net rc2 version). Hot reload failed to detect the changes. But... I came here because hot reload has never really worked for me. I already updated all my packages to .net 8. I just did a dotnet watch test just now and it's working. I have no words. Maybe I've only run the production .net 8 build from visual studio so far and maybe something was fixed from rc2 to prod in .net watch. Or maybe it only worked because I only changed some simple things and it'll break in an hour... Honestly I'll try it for the next few days and post back my experience. |
I'm delighted to say that I get the same result--what didn't work in the beta now somewhat works with SDK 8.0.100 RTM! Many thanks and kudos to @danroth27, @tmat, and anyone else who may have contributed to improve this. I say "Somewhat" because I frequently get full rebuilds even on mere .razor markup changes, but at least it all works! Would anyone have the time to tell us what the issue was? So far it seems like it was partially fixed in the prerelease and fully fixed in RTM, but I still have no idea what the problem was or why ASP.NET 8 fixes it. It will help me to be aware if similar or related issues come up in the future. @andrewaggb I'm going to close this issue as it fixes the sample repo above (which is now updated in main with the working version). I'll support a new issue if you make one, but you might want to provide a minimal repo that reproduces the problem. |
Does If not you can also set an env variable like so and share the generated logs dir, so we can take a look: |
Likely a race condition fixed here: dotnet/sdk#33007 |
Sorry, still getting the problem--no longer in the repo above, but in my main project I still get With .NET 8, and verbose on sadly, I still get:
Thanks for your theory, @tmat. I will try to get a repo that reproduces it but it might be tough. Any ideas to overcome? Any way to delay one side of the race you have in mind? Or can we somehow add verbose output when there is |
We think the remaining issue that you're facing is addressed by dotnet/sdk#36195, which I believe should ship in the upcoming 8.0.1 patch in January. If after updating to that new SDK you still face the issue, please file a new issue, so that we can investigate further. |
Is there an existing issue for this?
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
I got a lot of irrelevant info output, but after I edit Index.razor and save it, I get:
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: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
The text was updated successfully, but these errors were encountered: