Skip to content
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

Hotreload doesn't work on Blazor wasm (.NET6) #38576

Closed
darius-khll opened this issue Nov 22, 2021 · 15 comments
Closed

Hotreload doesn't work on Blazor wasm (.NET6) #38576

darius-khll opened this issue Nov 22, 2021 · 15 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-hot-reload This issue is related to the Hot Reload feaature
Milestone

Comments

@darius-khll
Copy link

Hotreload doesn't work on blazor wasm (.NET6 LTS)

I've created a brand new blazor wasm project using Visual Studio 2022 (Version 17.1.0 Preview 1.1) and couldn't get hotreload to work, HOWEVER it works perfectly fine on blazor server!

To Reproduce

Windows 11
Brand new .NET6 blazor wasm project
and then run "dotnet watch"
as soon as something is changed it's gonna end up with this particular message and should be restarted manually!

watch : File changed: C:\Users\alikh\source\repos\BlazorApp1\BlazorApp1\Pages\Index.razor.
watch : No hot reload changes to apply.
@TanayParikh TanayParikh added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-hot-reload This issue is related to the Hot Reload feaature labels Nov 22, 2021
@SteveSandersonMS
Copy link
Member

@pranavkm Can you suggest any diagnostic steps here? There's not much information to indicate what might be wrong.

@darius-khll
Copy link
Author

@SteveSandersonMS Please provide what exactly I'm meant to do, let me know and I'll be doing that ASAP :)
meanwhile I'll be looking for a way to find out potential logs and so on

@darius-khll
Copy link
Author

It's so bizarre actually, I just realized it works using this command "Dotnet watch --project ."
is it something particularly different in that way? I couldn't find it in official documentation, I just bumped into that one in some forums..

@darius-khll
Copy link
Author

However it won't be working using that certain trick for blazorwasm hosted with asp.net core :(

@mkArtakMSFT mkArtakMSFT changed the title Hotreload doesn't work on Blazo wasm (.NET6) Hotreload doesn't work on Blazor wasm (.NET6) Nov 29, 2021
@mkArtakMSFT mkArtakMSFT added this to the .NET 7 Planning milestone Nov 30, 2021
@ghost
Copy link

ghost commented Nov 30, 2021

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@Aquaritek
Copy link

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Umm I'm going to raise a flag here because for me it extends to the hosting environment also (meaning no clients receive updates after changes are published) and I think it's related. Please see my comment on this same topic in another issue thread #38809 (comment)

@szalapski
Copy link

szalapski commented Feb 24, 2022

This seems not to be fixed in SDK 6.0.200--when I do dotnet watch --project . from the Server directory, wait for it to spin up and load the page, then change the text on the page, I still get:

watch : File changed: C:\...\Client\...\MyComponent.razor.
watch : No hot reload changes to apply.

With --verbose, I get:

watch : File changed: C:\...\Client\...\MyComponent.razor.
watch : No deltas modified. Applying changes to clear diagnostics.
watch : Received 1 from browser in [Count: 1, MessageType: Binary, EndOfMessage: True].
watch : No hot reload changes to apply.
watch : Hot reload change handled in 5902.7638ms.

There are hot reload changes to apply. Come on, it is so close to working! Can anyone help?

@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 7 Planning, 6.0.x Aug 10, 2022
@mkArtakMSFT mkArtakMSFT assigned tmat and unassigned pranavkm Aug 10, 2022
@mkArtakMSFT
Copy link
Member

@tmat can you please look into this? This may already be fixed but wanted you to confirm.

@ChristopherHaws
Copy link
Contributor

This is happening to me also. Creating a new ASP.NET Core Hosted Web Assembly app and running dotnet watch from the Server directory.

@szalapski
Copy link

szalapski commented Sep 16, 2022

After trying and re-trying this and reconsidering it each time, I found that when I first start dotnet watch it works for me for several iterations, rebuilding automatically and reloading my page, before eventually (5 or 20 minutes later) it stops working and I get the bogus "No hot reload changes to apply", when it won't rebuild even though it should.

What information more is needed to troubleshoot this, beyond --verbose?

EDIT: now it is failing much more often, perhaps right away or after just a minute or too. Still getting bogus "No hot reload changes to apply." messages in the verbose output.

@MarcoMedrano
Copy link

MarcoMedrano commented Nov 26, 2022

Did anyone find a solution?
I moved to .NET 7 November release , it is still happening. dotnet watch or dotnet watch run they work well when first editing a file, after that:

dotnet watch ⌚ File changed: ./Pages/Index.razor.
dotnet watch ⌚ No hot reload changes to apply.

@szalapski
Copy link

See also #45519

@pedrinCjm
Copy link

This worked for me (.net 6 and .net 7):

  • Install NuGet package:
    Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
  • Add line in Startup.cs:
    services.AddControllersWithViews().AddRazorRuntimeCompilation();
  • Or in Program.cs:
    builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();

@szalapski
Copy link

szalapski commented Feb 21, 2023

Tried that, @pedrinCjm, but it didn't help me. I still get:

Starting...
dotnet watch 🔥 Hot reload capabilities: .
dotnet watch ⌚ File changed: .\Client\Pages\Index.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.

@tmat
Copy link
Member

tmat commented Sep 25, 2023

We have made multiple changes to address dotnet watch reliability. If the issue still reproduces with the latest .NET 8 SDK preview, please reopen the issue with --verbose output, the project it reproes with and what changes are made to the files.

@tmat tmat closed this as completed Sep 25, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-hot-reload This issue is related to the Hot Reload feaature
Projects
Status: Done
Development

No branches or pull requests