Sébastien
Sébastien

Reputation: 1697

Why isn't Blazor Hot Reload working as expected after a fresh install?

I wanted to try the hot relaod in Blazor .Net 6.

So I installed VS 2022 Preview with the latest .Net 6 Preview 7.

I started a clean new Blazor WASM, stared it (in debug mode) without any change, watched the result in the browser, made a simple change in the html and in the code, saved and click on the hot reload button (VS tells me that changed have been successfully applied) but there are no changes in the browser, not even if i reload the page (I have to recompile to see the changes).

I also tried in the console with dotnet watch, when I've made a change, the console said watch : File changed: XXX. watch : Hot reload of changes succeeded., but still no updates on the browser, even if I reload the page.

It acts like if there was no underlying recompilation or if Kestrel doesn't reload the newly created dll (but I've also tried IIS Express with no better results)...

When I watch some videos about it on Youtube, it seems to work without any other configuration, same on some blog posts.

What could be wrong?

Upvotes: 2

Views: 459

Answers (1)

Connor Low
Connor Low

Reputation: 7176

You're probably running into this bug:
https://github.com/dotnet/aspnetcore/issues/35339#issuecomment-898706237.

... Unfortunately we had a last minute regression in the WASM runtime that crept in to our preview7 build which manifested as this error. This is resolved in our rc.1 builds. You could grab our nightly builds at https://github.com/dotnet/installer#installers-and-binaries to verify it's fixed.

enter image description here

You can follow that installer link and grab the rc1 build. You will also need a NuGet.config with the following:

<configuration>
  <packageSources>
    <add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
  </packageSources>
</configuration>

FYI, I ran into the same issue and this solved it for me about a week back.

Upvotes: 1

Related Questions