question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hot Reload nearly always fails, with Blazor WebAssembly and "dotnet watch"

See original GitHub issue

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: image, or sometimes instead “Your debugged process might be corrupted and restarting it is recommended nearly always.”

The most relevant issue seems to be https://github.com/dotnet/aspnetcore/issues/40587, but there must be much more to that one that isn’t working right.

See also:

Seems like there are a lot of others struggling too but not commenting in GitHub issues, e.g.

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

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:29
  • Comments:53 (17 by maintainers)

github_iconTop GitHub Comments

24reactions
Stuart88commented, Dec 11, 2022

Hot Reload is just terrible.

I feel bad criticising any of this because in the end it’s a ‘free’ framework that most of us haven’t helped to develop, but…

There is absolutely no point in allowing and/or promoting the existence of hot reload in its current state. It is rubbish, useless, pointless. Every little change (and sometimes no change at all) requires a rebuild. It isn’t ‘hot reload’ AT ALL.

13reactions
Contengocommented, Jan 7, 2023

We have been working with Blazor for three years now, but are seriously contemplating switching everything to React solely because of this issue. The development experience is beyond painful - it would be better to switch the feature off and set the expectation that you always have to recompile. It’s the “waiting to see if it works, knowing it probably won’t” that kills all motivation and enthusiasm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

net 6 blazor wasm hot reload not working
I'm using Visual Studio 2022 and created a new Blazor webassembly app and ran it. The option for hot reload on file save...
Read more >
Hot Reload is rubbish : r/Blazor
I'm just here to inform, that almost a year later, with .NET 8 Preview, the issue is still there. Dotnet watch behavior seems...
Read more >
Weird errors problem with dotnet watch with blazor/wasm.
The issue might relates the .NET Hot Reload. From the .NET Hot Reload support for ASP.NET Core, we can see that the Blazor...
Read more >
Support .NET6 Hot Reload for Blazor Server ... - YouTrack
Hey, guys! dotnet watch is absolutely not the same as hot reload. Watch will cause whole application to reload at all. If you...
Read more >
'Epic Fail': ASP.NET PM Struggles with Blazor Hot Reload ...
He showed how, using dotnet watch , certain types of code changes that didn't lend themselves to Hot Reload automatically defaulted to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found