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 unavailable

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I am using the latest VS2022 17.6.0 Preview 4.0

The preview version created the BlazorServer project, and all hot reloads were invalidated without any prompt. I am unable to determine the reason

dotnet watch ⌚ File changed: C:\Users\wf-so\Downloads\HotReloadIssue45519Demo-main\HotReloadIssue45519Demo-main\TradeCars\Client\Pages\Index.razor.
dotnet watch ⌚ No hot reload changes to apply.
dotnet watch 🔥 Hot reload capabilities: Baseline AddMethodToExistingType AddStaticFieldToExistingType NewTypeDefinition ChangeCustomAttributes.
dotnet watch ⌚ File changed: C:\Users\wf-so\Downloads\HotReloadIssue45519Demo-main\HotReloadIssue45519Demo-main\TradeCars\Client\Pages\Index.razor.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 POST https://localhost:5008/_framework/blazor-hotreload application/json 2835
dotnet watch ⌚ Received 0 from browser in [Count: 1, MessageType: Binary, EndOfMessage: True].
dotnet watch ⌚ Received failed apply from delta applier.
  ❔ Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

dotnet-sdk-7.0.203

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 5 months ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
szalapskicommented, Jun 5, 2023

This is a direct successor to #45519, which was closed with “Likely fixed by https://github.com/dotnet/sdk/pull/31015.”, but it was not fixed. I wish someone would have tested it with the provided example before deeming it “likely fixed”. The test is very easy.

Here’s the minimal example, the same one that was provided in #45519, now upgraded to use SDK 7.0.302

szalapski/HotReloadIssue45519Demo

Clone this and run

dotnet watch --verbose --project ./TradeCars/Server

The site should start up. You’ll see Hot reload capabilities: . which portends the failure. Edit anything in Index.razor to watch hot reload fail.

Please get Hot Reload to work reliably and consistently with Blazor WebAssembly (and Blazor Server, likely the same problem), 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.5 and SDK 7.0.302 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.”

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).
1reaction
szalapskicommented, Jun 22, 2023

Thanks @tmat. I got rid of the notion of “Developer” in my demo app, instead using “Development”, and I modified Program.cs accordingly, and I still see no change. I still get dotnet watch ⌚ No hot reload changes to apply. Would you be willing to pull the latest and run the demo app (see README.md) and see if you can get HotReload to work?

https://github.com/szalapski/HotReloadIssue45519Demo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to Hot Reload on Visual Studio 2022
Press the Hot Reload icon in the toolbar, then Settings from the icon's context menu (or access via Tools > Settings > Debugging)...
Read more >
Troubleshooting XAML Hot Reload - Visual Studio
If Hot Reload isn't available · Verify that XAML Hot Reload is enabled · Verify that you use Start Debugging rather than Attach...
Read more >
Visual Studio 2022: Hot Reload Guide
Once you've installed Visual Studio 2022, Hot Reload is enabled by default. However, you can check its status by navigating to Tools >...
Read more >
Enable Hot Reload In Visual Studio 2022
Learn how to enable hot reload in Visual Studio. Change and debug your code faster without rebuilding the application.
Read more >
Anyone else having huge problems with VS 2022 and Hot ...
Hot reload is and always has been a hot mess. It's so limited and personally I turn it off because it's worse than...
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