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

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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 25 (14 by maintainers)

Most upvoted comments

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.

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.

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

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

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 (https://github.com/dotnet/runtime/pull/63513). It should be available in the first .NET 7 preview.

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

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.