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

Blazor Hot Reload: MatBlazor Button breaks Hot reload in Dotnet 6 preview 3. #51126

Closed
vallgrenerik opened this issue Apr 10, 2021 · 25 comments
Closed
Assignees
Labels
arch-wasm WebAssembly architecture area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc
Milestone

Comments

@vallgrenerik
Copy link

Describe the bug

Hello!
First: Thanks for fantastic work with Hot reload. It looks promising!
But unfortunately a MatBlazor (https://www.matblazor.com/) button "MatButton" makes the hot reload crash.

To Reproduce

I've created a repo https://github.com/vallgrenerik/HotReloadTest
(A simple Blazor WASM ASP.Core Hosted)
Look inside the Index.razor in the .Client project.

Uncomment the button to make it crash.
Comment out the MatButton, press CTRL + R in terminal to force reload and the Hot reload works again.

Exceptions (if any)

The crash appears in the browser console like this:

* Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, 
condition `<disabled>' not met

Full crash:

dotnet.6.0.0-preview.3.21201.4.js:1 * Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, condition `<disabled>' not met

542288 @ dotnet.6.0.0-preview.3.21201.4.js:1
_emscripten_asm_const_int @ dotnet.6.0.0-preview.3.21201.4.js:1
(anonymous) @ 008ace4e:0xdec8e
(anonymous) @ 008ace4e:0x19281b
(anonymous) @ 008ace4e:0x107942
(anonymous) @ 008ace4e:0x8b218
(anonymous) @ 008ace4e:0xf002
(anonymous) @ 008ace4e:0x7c6f
(anonymous) @ 008ace4e:0x56f3
(anonymous) @ 008ace4e:0x1a180a
(anonymous) @ 008ace4e:0x11988d
(anonymous) @ 008ace4e:0xee6f7
(anonymous) @ 008ace4e:0xdf021
(anonymous) @ 008ace4e:0xe1e41
(anonymous) @ 008ace4e:0x46356
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0xfcc5
(anonymous) @ 008ace4e:0x10dc13
(anonymous) @ 008ace4e:0xee3e6
(anonymous) @ 008ace4e:0xedf47
(anonymous) @ 008ace4e:0x194d3b
(anonymous) @ 008ace4e:0x59c7c
(anonymous) @ 008ace4e:0x46258
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0x152f4
(anonymous) @ 008ace4e:0x10e00d
fb @ 008ace4e:0x108652
Module._mono_wasm_invoke_method @ dotnet.6.0.0-preview.3.21201.4.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet @ managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet:19
invokeDotNetFromJS @ blazor.webassembly.js:1
m @ blazor.webassembly.js:1
e.invokeMethod @ blazor.webassembly.js:1
he._internal.applyHotReload @ blazor.webassembly.js:1
(anonymous) @ aspnetcore-browser-refresh.js:101
applyBlazorDeltas @ aspnetcore-browser-refresh.js:101
BlazorHotReloadDeltav1 @ aspnetcore-browser-refresh.js:31
connection.onmessage @ aspnetcore-browser-refresh.js:37
Show 11 more frames

Further technical details

  • ASP.NET Core version 6.0.0-preview.3.21201.13
  • Include the output of dotnet --info
dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.3.21202.5
 Commit:    aee38a6dd4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
  Version: 6.0.0-preview.3.21201.4
  Commit:  236cb21e3c

.NET SDKs installed:
  3.1.407 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.20614.14 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.21077.7 [C:\Program Files\dotnet\sdk]
  5.0.201 [C:\Program Files\dotnet\sdk]
  6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  • Microsoft Visual Studio Professional 2019 Preview
    Version 16.10.0 Preview 1.0
@vallgrenerik vallgrenerik changed the title MatBlazor Button breaks Hot reload in Dotnet 6 preview 3. Blazor Hot Reload: MatBlazor Button breaks Hot reload in Dotnet 6 preview 3. Apr 10, 2021
@MRakesh
Copy link

MRakesh commented Apr 10, 2021

It is not worked for me also and checked my network it is missing downloading of 127.0.0.1 websocket, connection.
Fixed after adding <script src="/_framework/aspnetcore-browser-refresh.js"></script>
below <script src="_framework/blazor.webassembly.js"></script> and hot reload is working with any libraries like ( matblazor and others).
Hot Reload is not working with Lazy Loaded Razor Class Library Pages (In my case).

@vallgrenerik
Copy link
Author

@MRakesh Okey, are you sure it works? Have you tried restarting the dotnet watch?
Even if I add <script src="/_framework/aspnetcore-browser-refresh.js"></script> it's still crashing.
With the browser-refresh.js the error now looks like this:

dotnet.6.0.0-preview.3.21201.4.js:1 Uncaught Error: System.TypeLoadException: EnC: cannot add new method with token 0x06000033
   at System.Reflection.Metadata.AssemblyExtensions.ApplyUpdate(Assembly assembly, ReadOnlySpan`1 metadataDelta, ReadOnlySpan`1 ilDelta, ReadOnlySpan`1 pdbDelta)
   at Microsoft.AspNetCore.Components.WebAssembly.Infrastructure.JSInteropMethods.ApplyHotReloadDelta(String moduleId, Byte[] metadataDelta, Byte[] ilDeta)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.Invoke(JSRuntime jsRuntime, DotNetInvocationInfo& invocationInfo, String argsJson)
   at Microsoft.AspNetCore.Components.WebAssembly.Services.DefaultWebAssemblyJSRuntime.InvokeDotNet(String assemblyName, String methodIdentifier, String dotNetObjectId, String argsJson)
    at Object._convert_exception_for_method_call (https://localhost:5011/_framework/dotnet.6.0.0-preview.3.21201.4.js:1:194923)
    at Object._handle_exception_for_call (https://localhost:5011/_framework/dotnet.6.0.0-preview.3.21201.4.js:1:196892)
    at managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet (https://mono-wasm.invalid/managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet:20:21)
    at Object.invokeDotNetFromJS (https://localhost:5011/_framework/blazor.webassembly.js:1:33466)
    at m (https://localhost:5011/_framework/blazor.webassembly.js:1:1068)
    at Object.e.invokeMethod (https://localhost:5011/_framework/blazor.webassembly.js:1:2130)
    at Object.he._internal.applyHotReload (https://localhost:5011/_framework/blazor.webassembly.js:1:49030)
    at https://localhost:5011/_framework/aspnetcore-browser-refresh.js:101:49
    at Array.forEach (<anonymous>)
    at applyBlazorDeltas (https://localhost:5011/_framework/aspnetcore-browser-refresh.js:101:12)

@pranavkm
Copy link
Contributor

FYI @lambdageek

@lambdageek lambdageek self-assigned this Apr 10, 2021
@lambdageek
Copy link
Member

Haven't tried running the repro yet, but looking at the source for MatButton, I see it has a RenderFragment ChildContent parameter.
RenderFragments compile down to C# lambdas, which are not supported yet in WebAssembly hot reload. It's something I'm looking into, but it's not in this preview yet.

@Xuntar
Copy link

Xuntar commented Apr 11, 2021

Love the hot reload functionality, but the fact that RenderFragment parameters are not working yet is a huge bummer (I understand it's in preview though, of course).
As far as I could read on Preview 3 blog post, it should automatically rebuild and restart the app if it detects a change it can't apply. Is there a way to make it do that instead of crashing (ideally without having to wait for preview 4)?

@lambdageek
Copy link
Member

lambdageek commented Apr 12, 2021

As far as I could read on Preview 3 blog post, it should automatically rebuild and restart the app if it detects a change it can't apply. Is there a way to make it do that instead of crashing (ideally without having to wait for preview 4)?

Yes, the goal overall is to get to a point where:

  1. edits that are supported by MonoVM hot reload will apply without crashing
  2. edits that aren't supported are detected by dotnet watch/Roslyn and the app is restarted.

At the moment MonoVM and Roslyn aren't yet on the same page about what's supported. (Partly because we are working on expanding what Mono can do. The Roslyn team would have to do some work to reliably detect and report rude edits, only to undo that work in the next release.)

I realize that leaves folks trying it out now in a quite painful situation in the meantime, please bear with us.

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Apr 12, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 12, 2021
@mkArtakMSFT mkArtakMSFT added the arch-wasm WebAssembly architecture label Apr 12, 2021
@ghost
Copy link

ghost commented Apr 12, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the bug

Hello!
First: Thanks for fantastic work with Hot reload. It looks promising!
But unfortunately a MatBlazor (https://www.matblazor.com/) button "MatButton" makes the hot reload crash.

To Reproduce

I've created a repo https://github.com/vallgrenerik/HotReloadTest
(A simple Blazor WASM ASP.Core Hosted)
Look inside the Index.razor in the .Client project.

Uncomment the button to make it crash.
Comment out the MatButton, press CTRL + R in terminal to force reload and the Hot reload works again.

Exceptions (if any)

The crash appears in the browser console like this:

* Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, 
condition `<disabled>' not met

Full crash:

dotnet.6.0.0-preview.3.21201.4.js:1 * Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, condition `<disabled>' not met

542288 @ dotnet.6.0.0-preview.3.21201.4.js:1
_emscripten_asm_const_int @ dotnet.6.0.0-preview.3.21201.4.js:1
(anonymous) @ 008ace4e:0xdec8e
(anonymous) @ 008ace4e:0x19281b
(anonymous) @ 008ace4e:0x107942
(anonymous) @ 008ace4e:0x8b218
(anonymous) @ 008ace4e:0xf002
(anonymous) @ 008ace4e:0x7c6f
(anonymous) @ 008ace4e:0x56f3
(anonymous) @ 008ace4e:0x1a180a
(anonymous) @ 008ace4e:0x11988d
(anonymous) @ 008ace4e:0xee6f7
(anonymous) @ 008ace4e:0xdf021
(anonymous) @ 008ace4e:0xe1e41
(anonymous) @ 008ace4e:0x46356
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0xfcc5
(anonymous) @ 008ace4e:0x10dc13
(anonymous) @ 008ace4e:0xee3e6
(anonymous) @ 008ace4e:0xedf47
(anonymous) @ 008ace4e:0x194d3b
(anonymous) @ 008ace4e:0x59c7c
(anonymous) @ 008ace4e:0x46258
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0x152f4
(anonymous) @ 008ace4e:0x10e00d
fb @ 008ace4e:0x108652
Module._mono_wasm_invoke_method @ dotnet.6.0.0-preview.3.21201.4.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet @ managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet:19
invokeDotNetFromJS @ blazor.webassembly.js:1
m @ blazor.webassembly.js:1
e.invokeMethod @ blazor.webassembly.js:1
he._internal.applyHotReload @ blazor.webassembly.js:1
(anonymous) @ aspnetcore-browser-refresh.js:101
applyBlazorDeltas @ aspnetcore-browser-refresh.js:101
BlazorHotReloadDeltav1 @ aspnetcore-browser-refresh.js:31
connection.onmessage @ aspnetcore-browser-refresh.js:37
Show 11 more frames

Further technical details

  • ASP.NET Core version 6.0.0-preview.3.21201.13
  • Include the output of dotnet --info
dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.3.21202.5
 Commit:    aee38a6dd4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
  Version: 6.0.0-preview.3.21201.4
  Commit:  236cb21e3c

.NET SDKs installed:
  3.1.407 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.20614.14 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.21077.7 [C:\Program Files\dotnet\sdk]
  5.0.201 [C:\Program Files\dotnet\sdk]
  6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  • Microsoft Visual Studio Professional 2019 Preview
    Version 16.10.0 Preview 1.0
Author: vallgrenerik
Assignees: lambdageek
Labels:

arch-wasm, untriaged

Milestone: -

@ghost
Copy link

ghost commented Apr 13, 2021

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the bug

Hello!
First: Thanks for fantastic work with Hot reload. It looks promising!
But unfortunately a MatBlazor (https://www.matblazor.com/) button "MatButton" makes the hot reload crash.

To Reproduce

I've created a repo https://github.com/vallgrenerik/HotReloadTest
(A simple Blazor WASM ASP.Core Hosted)
Look inside the Index.razor in the .Client project.

Uncomment the button to make it crash.
Comment out the MatButton, press CTRL + R in terminal to force reload and the Hot reload works again.

Exceptions (if any)

The crash appears in the browser console like this:

* Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, 
condition `<disabled>' not met

Full crash:

dotnet.6.0.0-preview.3.21201.4.js:1 * Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, condition `<disabled>' not met

542288 @ dotnet.6.0.0-preview.3.21201.4.js:1
_emscripten_asm_const_int @ dotnet.6.0.0-preview.3.21201.4.js:1
(anonymous) @ 008ace4e:0xdec8e
(anonymous) @ 008ace4e:0x19281b
(anonymous) @ 008ace4e:0x107942
(anonymous) @ 008ace4e:0x8b218
(anonymous) @ 008ace4e:0xf002
(anonymous) @ 008ace4e:0x7c6f
(anonymous) @ 008ace4e:0x56f3
(anonymous) @ 008ace4e:0x1a180a
(anonymous) @ 008ace4e:0x11988d
(anonymous) @ 008ace4e:0xee6f7
(anonymous) @ 008ace4e:0xdf021
(anonymous) @ 008ace4e:0xe1e41
(anonymous) @ 008ace4e:0x46356
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0xfcc5
(anonymous) @ 008ace4e:0x10dc13
(anonymous) @ 008ace4e:0xee3e6
(anonymous) @ 008ace4e:0xedf47
(anonymous) @ 008ace4e:0x194d3b
(anonymous) @ 008ace4e:0x59c7c
(anonymous) @ 008ace4e:0x46258
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0x152f4
(anonymous) @ 008ace4e:0x10e00d
fb @ 008ace4e:0x108652
Module._mono_wasm_invoke_method @ dotnet.6.0.0-preview.3.21201.4.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet @ managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet:19
invokeDotNetFromJS @ blazor.webassembly.js:1
m @ blazor.webassembly.js:1
e.invokeMethod @ blazor.webassembly.js:1
he._internal.applyHotReload @ blazor.webassembly.js:1
(anonymous) @ aspnetcore-browser-refresh.js:101
applyBlazorDeltas @ aspnetcore-browser-refresh.js:101
BlazorHotReloadDeltav1 @ aspnetcore-browser-refresh.js:31
connection.onmessage @ aspnetcore-browser-refresh.js:37
Show 11 more frames

Further technical details

  • ASP.NET Core version 6.0.0-preview.3.21201.13
  • Include the output of dotnet --info
dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.3.21202.5
 Commit:    aee38a6dd4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
  Version: 6.0.0-preview.3.21201.4
  Commit:  236cb21e3c

.NET SDKs installed:
  3.1.407 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.20614.14 [C:\Program Files\dotnet\sdk]
  5.0.200-preview.21077.7 [C:\Program Files\dotnet\sdk]
  5.0.201 [C:\Program Files\dotnet\sdk]
  6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  • Microsoft Visual Studio Professional 2019 Preview
    Version 16.10.0 Preview 1.0
Author: vallgrenerik
Assignees: lambdageek
Labels:

arch-wasm, area-Debugger-mono, untriaged

Milestone: -

@lambdageek lambdageek added area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc and removed area-Debugger-mono untriaged New issue has not been triaged by the area owner labels Apr 23, 2021
@lambdageek lambdageek added this to the 6.0.0 milestone Apr 23, 2021
@dicarne
Copy link

dicarne commented Apr 29, 2021

AntDesign also crash. In fact, I guess any third-party UI framework will cause this problem. Hotreload worked well when I create a new project, but it carshed when I import AntDesign.

@anddrzejb
Copy link

I am a member of AntDesign. I just run my own tests and in my case I did not experience crashes. In my case best Hot Reload experience is with server-side. My changes were immediately applied. In case of wasm - if I had any component of AntDesign in my razor file, the changes I was making were not applied. I had to press Ctrl+R, then they were applied. If I commented out AntDesign component - changes were applied. I also created a basic razor library to have comparison - and basic library changes are reflected.

One curious scenario - when AntDesign component was already added, on first run when I commented it out, hot reload was kicking in and the component was removed from DOM. Uncommenting had no effect - it was not added again. If on the first run I made any other change (either to the AntDesign component or for example just added a text), hot reload was not working. Then removing AntDesign component had no effect either.

Eventually I replaced AntDesign nuget with direct reference to AntDesing project. I upgraded it to net6 but it had no effect.
After upgrading to net6 I tried to do some development in the AntDesign. My setup is that I have a main project which references AntDesign. Hot reload was not working there (this is on server-side). When I was making a change to AntDesign, hot reload was not seeing it. I was at least expecting a message in the console in form of watch: File changed (...) but not even that. Eventually I narrowed it down to the fact that AntDesign is targeting multiple frameworks. So I had to replace this

    <TargetFrameworks>netstandard2.1;net5;net6</TargetFrameworks>

with this

    <TargetFramework>net6</TargetFramework>

and hot reload started working. Of course I had to also comment out couple of <ItemGroup Condition="$(TargetFramework) == ''(...)"> condition groups. Hot reload wasn't fast, but I guess this is because AntDesign is a fairly large project? Again, this is only for server side.
@dicarne I can publish my repro - maybe you'll be able to track down the differences and why my project is not crashing.

@dicarne
Copy link

dicarne commented Apr 29, 2021

My TargetFramework is <TargetFramework>net6</TargetFramework>. I use wasm and removed all condition groups. I even clone AntDesign and compiled a net6 version, but it didn't help.
I use dotnet watch to start. Page looks great until I change something in source code.
And errors occur in console:

* Assertion at /__w/1/s/src/mono/mono/metadata/metadata-update.c:809, condition `<disabled>' not met

542288 @ dotnet.6.0.0-preview.3.21201.4.js:1
_emscripten_asm_const_int @ dotnet.6.0.0-preview.3.21201.4.js:1
(anonymous) @ 008ace4e:0xdec8e
(anonymous) @ 008ace4e:0x19281b
(anonymous) @ 008ace4e:0x107942
(anonymous) @ 008ace4e:0x8b218
(anonymous) @ 008ace4e:0xf002
(anonymous) @ 008ace4e:0x7c6f
(anonymous) @ 008ace4e:0x56f3
(anonymous) @ 008ace4e:0x1a180a
(anonymous) @ 008ace4e:0x11988d
(anonymous) @ 008ace4e:0xee6f7
(anonymous) @ 008ace4e:0xdf021
(anonymous) @ 008ace4e:0xe1e41
(anonymous) @ 008ace4e:0x46356
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0xfcc5
(anonymous) @ 008ace4e:0x10dc13
(anonymous) @ 008ace4e:0xee3e6
(anonymous) @ 008ace4e:0xedf47
(anonymous) @ 008ace4e:0x194d3b
(anonymous) @ 008ace4e:0x59c7c
(anonymous) @ 008ace4e:0x46258
(anonymous) @ 008ace4e:0x12dfac
(anonymous) @ 008ace4e:0x117c6e
(anonymous) @ 008ace4e:0x7a160
(anonymous) @ 008ace4e:0x152f4
(anonymous) @ 008ace4e:0x10e00d
fb @ 008ace4e:0x108652
Module._mono_wasm_invoke_method @ dotnet.6.0.0-preview.3.21201.4.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet @ managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_InvokeDotNet:19
invokeDotNetFromJS @ blazor.webassembly.js:1
m @ blazor.webassembly.js:1
e.invokeMethod @ blazor.webassembly.js:1
he._internal.applyHotReload @ blazor.webassembly.js:1
(anonymous) @ aspnetcore-browser-refresh.js:101
applyBlazorDeltas @ aspnetcore-browser-refresh.js:101
BlazorHotReloadDeltav1 @ aspnetcore-browser-refresh.js:31
connection.onmessage @ aspnetcore-browser-refresh.js:37
Show 11 more frames
ExitStatus {name: "ExitStatus", message: "Program terminated with exit(0)", status: 0}
message: "Program terminated with exit(0)"
name: "ExitStatus"
status: 0

If I remove AntDesign, hotreload works again. @anddrzejb I guess wasm hotreload is not support well.

@anddrzejb
Copy link

@dicarne You are right. Somehow I missed the exceptions in the browser...

@lambdageek
Copy link
Member

@anddrzejb @dicarne Blazor server-side and browser have different hot reload capabilities - currently there are more limitations on the browser side. For the .NET 6 release, we're working to bring the WebAssembly hot reload closer to the capabilities of Blazor on the server, and to improve diagnostics so that the app falls back to restarting if we cannot hot reload the code on the browser.

@pranavkm
Copy link
Contributor

Thanks @lambdageek. To chime in, our approach here is multi-fold

a) WebAssembly's hot reload capabilities should improve over time. Simultaneously the compiler is adding support to allow more kinds of edit to be made.
b) The compiler is being made aware of what sort of edits the runtime cannot support. So hot reload should be able to fail faster
c) As of preview4, dotnet-watch detects these failures and restarts the app. So the experience is less jarring when things do fail.

@anddrzejb
Copy link

I do remember from the blog post that wasm experience is behind in comparison to server-side.

I wanted also to emphasize that in server-side it seems that hot reload is not working for libraries that target multiple frameworks.

@lambdageek
Copy link
Member

I wanted also to emphasize that in server-side it seems that hot reload is not working for libraries that target multiple frameworks.

@pranavkm is there an issue already for this ^^^ ?

@pranavkm
Copy link
Contributor

@anddrzejb could you file a separate issue for this in https://github.com/dotnet/aspnetcore possibly with a minimal app that reproduces the problem? We haven't tested this particular scenario but it's surprising to know that multi-targeting affects this.

@anddrzejb
Copy link

anddrzejb commented Apr 29, 2021

Sure, I will try to prep something. I think that is the problem - once I removed multitargeting from AntDesign, hot reload started to work. When I reversed it - it stopped working.

Edit: Created issue #52073

@lewing
Copy link
Member

lewing commented Jul 31, 2021

@lambdageek what is the status of this?

@lambdageek
Copy link
Member

This issue is essentially a duplicate of #50249 at this point.

Updating of existing lambda bodies that are generated from .razor pages will become supported once dotnet/roslyn#55407 makes it into the dotnet SDK.

That means editing a page that has existing MatBlazor buttons should work

Adding new lambdas will be .net 7

Adding new MatBlazor buttons will be a rude edit in .net 6 and will cause the blazor webassembly app to ask to restart.

@lambdageek
Copy link
Member

Adding new lambdas will be .net 7

Adding new MatBlazor buttons will be a rude edit in .net 6 and will cause the blazor webassembly app to ask to restart.

The initial support for hot reload edits that add new lambdas has been added (#63513). It should be available in the first .NET 7 preview.

@vallgrenerik
Copy link
Author

Thanks for the update @lambdageek
Should I close this issue?

@lambdageek
Copy link
Member

@vallgrenerik I'd prefer to keep it open until a preview is out and I can verify that it's working.

@ilonatommy
Copy link
Member

@lambdageek, I tested in 7 preview 4 - it does not crash, hot reload with the button works. I am closing.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc
Projects
None yet
Development

No branches or pull requests