aspnetcore: .NET 8 Blazor WASM Debugging and Hot Reload are very buggy.
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have a Blazor WASM project that I developed in .NET 7 where the debugger worked great and the hot reload worked well enough, but never great, mostly, every once in a while, I would have to close VS 2022 and re-open to get the hot reload to work.
Since I upgraded to .NET 8 the debugger and the hot reload are pretty much broken.
-
The debugger will work sometimes, maybe 30% of the time but:
- VS 2022 will freeze for 30 seconds to 1 minute and then respond. It does this every so often.
- The debugger will get stuck stopping on a break point. I will set a break point, it will stop there, I will hit
Continueand it just keeps stopping there, even when I take the break point away. - Maybe 25% of the time, I will get these break points in a dynamic java script file that says
Source content not found.and it will keep stopping my debugger until I close the dynamic file.
-
The Hot Reload doesn’t even work enough for me to use it.
- Can make a change and it will still say “No changes were found.” - Even something as simple as adding a class to an HTML element.
- Can make a change and it will apply the change and then crash with:
19:25 51.68 XXXXXXX (Web assembly): Hot reload session started 19:27 50.64 Checking for updates... 19:28 05.40 Applying updates... 19:28 05.41 XXXXXXX (Web assembly): Sending updates to running application 19:28 15.48 XXXXXXX (Web assembly): [Error] Applying updates to the application failed. A task was canceled. A task was canceled. 19:28 15.48 Exception thrown for Apply code updates: 0x80131500 - A task was canceled. 19:28 15.49 An unexpected error has occurred, any pending updates have been discarded.
I have spent a few hours looking on the internet for information and fixes and reports from other people, but nothing has worked so far.
I would really appreciate some help on this, because without these two features, development is incredibly slow and painful.
Expected Behavior
- The debugger does not freeze VS every time I startup the app.
- The debugger does not repeatedly stop on a breakpoint even after I press continue.
- The debugger does not stop on break points when they have been removed.
- The debugger does not break on random dynamic JavaScript.
- The hot reload functions.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
8.0.102
Anything else?
.NET SDK: Version: 8.0.102 Commit: 64f1bc458e Workload version: 8.0.100-manifests.8a11730e
Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.102\
.NET workloads installed: Workload version: 8.0.100-manifests.8a11730e [maui-windows] Installation Source: VS 17.8.34601.278 Manifest Version: 8.0.6/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.6\WorkloadManifest.json Install Type: Msi
[maccatalyst] Installation Source: VS 17.8.34601.278 Manifest Version: 17.2.8004/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.2.8004\WorkloadManifest.json Install Type: Msi
[ios] Installation Source: VS 17.8.34601.278 Manifest Version: 17.2.8004/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.2.8004\WorkloadManifest.json Install Type: Msi
[android] Installation Source: VS 17.8.34601.278 Manifest Version: 34.0.43/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.43\WorkloadManifest.json Install Type: Msi
Host: Version: 8.0.2 Architecture: x64 Commit: 1381d5ebd2
.NET SDKs installed: 8.0.102 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.2 [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
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 33
- Comments: 27 (4 by maintainers)
I confirm this. I am using the latest version of VS and I spend more time doing these tasks than writing actual code.
*Starting the project (especially in debug mode). This is understandable since it is creating a binary.
Our whole team is experiencing similar issues. It is a major dealbreaker for us, debugging and hot reload must work reliably for modern app development.
I recommend to make this a top 1 priority.
Watching the community standup the other day with @danroth27, I can see that this is something you guys are prioritizing.
I thought this might be a good time/place to draw attention to my suggestion here, of improving the fallback experience when it can’t hot reload and needs to build. Based on my experience with angular, rather than closing the browser, could it put it on hold while it’s building and then hard-refresh. Obviously that will reset things but at least you’ll still be on the page url with your fresh code. A bit less flow-breaking.
using .net 9 and vs2022 preview hot reload does not even work at all
This is driving me crazy. It was (mostly) working a month ago. Now after updating to VS 17.10 and v8.0.300 SDK I am plagued with problems debugging a hosted WASM app. It breaks in the debugger where there are no breakpoints. In fact it is breaking in code imported through PackageReference. So not even my code!
I have been developing professionally for about 28 years now, starting with VB3 back in the 90’s and I do not think I have ever been as frustrated as I am right now. Time to check out Rider?
I’m experiencing the same problem in Visual Studio 2022 (Version 17.9.0) .NET 8 Blazor WASM app.
I just got our, pretty huge, code-base working with Hot Reload again, after 4-5 months of it hardly working at all, and it might be worth it for someone to read.
I opened our solution in “Rider”, just to check if it would work better there. But before I could even get it running I had several syntax- and reference-errors popping up in Rider. I went through them, removed extra unwanted semi-colons, some using aliases that apparently were in conflict and one component parameter that it could not parse. After those fixes I started the solution in VS 2022 again, and Hot Reload suddenly worked “flawlessly” (i.e. as it did previously - by no means perfect, but minor changes to razor/css/js usually works now).
Now I am a bit worried that VS has not picked up on these errors. Apparently it could still compile and run, but Hot reload and debugging was not working as expected.
I have the same issues. I just started developing using .NET and it’s just baffling to me how unstable and unreliable even such basic features seem to be, having proper hot reloading for many years with frontend frameworks like React and Vue.
Same problem here, updated old hosted WASM to .net 8, and not a single breakpoint works anymore…
I have given up on hot reload. It does not work when the project has a moderate size or bigger (e.g. having many libraries with components with multiple levels of inheritance).
I’m experiencing the same problem in Visual Studio 2022 (Version 17.9.2) .NET 8 Blazor WASM app. Hot reload almost never Debugging not working properly
is there a release date for this fix? Basically anytime the razor file is changed, the app needs to be restarted. Refreshing the page doesn’t work either as its all cached.
I’m have issues as well when trying to run in Debug mode, every time I stop debugging mode I have to wait 1-2 minutes and then I will get this message to stop now, clicking stop now takes another 30 seconds or so before I can start coding again! Very frustrating when I need to start and stop several times in a day, losing so much time on this! Was not an issue until I upgraded to the latest Visual Studio, and .NET 8 latest versions.
Also running into the issue where hot reload doesn’t work at all anymore on recent versions of .Net.
I’ve noticed that when using the .Net SDK 8.0.402, it still works, but starting with version 8.0.403, it no longer works. Guess it’s forbidden? (Sorry).
The websocket still connects, the checkmark still pops up, and I still see the message loop going:
But no actual changes are being applied, as far as I can tell.
Also maybe noteworthy, the dotnet.js scripts and such went from “8.0.8” to “8.0.10”. To be expected, but I wonder if that’s where things are going awry.
I confirm, I am running latest .NET 8, latest 8.0.10 packages, and every time I save a page I get:
I also have another issue, but I do not think it is related to it:
But it is really annoying to rebuild the page to see any Blazor WASM changes.
I tried this. Debugging is still hit or miss for WASM projects.
The debugger slowing and hanging is a visual studio issue (that is tracked here). Other people in my team using Rider or VS Code do not have this issue. It is reported as fixed and will be released in version 17.10 of Visual Studio.
Hot reload is a different beast however. It almost never worked for me too. Sure it works if I create a new blazor web app project, that has a few components and references, but when trying to use it in a solution with many projects and components with complex inheritance trees (that are .cs) then it is unusable.
@DuckScapePhilip thanks for contacting us.
Can you file an issue through the report a problem dialog in visual studio? https://learn.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022
That will take care of capturing all the information we might need to troubleshoot and debug the issue.
Please link the new issue here so that we can keep track of it.