You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[mbr] hot reload doesn't work on lambda bodies #50249
The hot reload feature seems to work a lot better on Index.razor than on certain other files. I'm not sure why the behavior differs.
Steps:
Use latest preview 3 SDK
dotnet new blazorwasm -o MyApp
cd MyApp
dotnet watch
When the app is running, modify some text in Pages/Index.razor - see it appears correctly in the browser
Now try a similar edit inside Shared/NavMenu.razor, for example change the text Home to Home2.
Expected: change is applied
Actual: runtime crashes
Configuration
This is with SDK 6.0.100-preview.3.21173.6, with Microsoft.NETCoreSdk.BundledVersions.props patched to use the runtime version 6.0.0-preview.4.21174.4.
@SteveSandersonMS when reporting these, one thing that would be super helpful:
Save the baseline .dll
Open a JS console and put a breakpoint in aspnetcore-browser-refresh.js in the applyBlazorDeltas function inside the foreach.
When it hits the breakpoint, in the console display the values of d.metadataDelta and d.ilDelta and save them. (please make sure that the JS console isn't eliding the middle with "...")
hit Continue in the JS debugger and repeat for any other deltas.
The body of the NavLink component is a RenderFragment lambda, and changing "Home" => "Home2" is updating the lambda body. It's emitting new fields and methods on the lambda, which Mono MBR doesn't support yet. (ie this is a rude edit - but we need dotnet/roslyn#49010 in order to signal it)
(Update, just for my info)
The decompiled relevant part of NavMenu::BuildRenderTree body before the update is:
changed the title [-]WebAssembly hot reload always fails on certain files[/-][+][mbr] WebAssembly hot reload always fails on certain files[/+]on Mar 25, 2021
changed the title [-][mbr] WebAssembly hot reload always fails on certain files[/-][+][mbr] hot reload doesn't work on lambda bodies[/+]on Mar 25, 2021
Updating the bodies of existing lambdas might happen in 6 - there are some circumstances where dotnet watch+Roslyn emit a delta that puts an updated lambda body into a new method where in CI we see Roslyn update an existing lambda body. We should be able to get dotnet watch+Roslyn to update existing lambdas, too.
Adding new lambdas (either static lambdas that don't capture anything, or new lambdas that capture this when there is already at least one lambda that captures this, or lambdas that capture locals (as long as there's already at least one lambda that captures the same locals) will be supported in the first preview of .NET 7 (Fixed in #63513).
Activity
SteveSandersonMS commentedon Mar 25, 2021
@lambdageek I've no idea if this is also addressed by #50248 but thought it best to report it rather than waiting to see.
lambdageek commentedon Mar 25, 2021
@SteveSandersonMS doesn't look like it's the same thing.
@SteveSandersonMS when reporting these, one thing that would be super helpful:
aspnetcore-browser-refresh.jsin theapplyBlazorDeltasfunction inside theforeach.d.metadataDeltaandd.ilDeltaand save them. (please make sure that the JS console isn't eliding the middle with "...")lambdageek commentedon Mar 25, 2021
The body of the
NavLinkcomponent is aRenderFragmentlambda, and changing"Home" => "Home2"is updating the lambda body. It's emitting new fields and methods on the lambda, which Mono MBR doesn't support yet. (ie this is a rude edit - but we need dotnet/roslyn#49010 in order to signal it)(Update, just for my info)
The decompiled relevant part of
NavMenu::BuildRenderTreebody before the update is:Update
So really this is an issue about supporting updates of lambdas. Which we should do. But we're not there yet
[-]WebAssembly hot reload always fails on certain files[/-][+][mbr] WebAssembly hot reload always fails on certain files[/+][-][mbr] WebAssembly hot reload always fails on certain files[/-][+][mbr] hot reload doesn't work on lambda bodies[/+]2 remaining items
lewing commentedon Jul 31, 2021
@lambdageek is this still targeting 6.0?
lambdageek commentedon Aug 1, 2021
Emitting new lambdas is going to be 7.
Updating the bodies of existing lambdas might happen in 6 - there are some circumstances where
dotnet watch+Roslyn emit a delta that puts an updated lambda body into a new method where in CI we see Roslyn update an existing lambda body. We should be able to getdotnet watch+Roslyn to update existing lambdas, too.lambdageek commentedon Aug 13, 2021
Updating of existing lambda bodies that are generated from .razor pages will become supported once dotnet/roslyn#55407 makes it into the dotnet SDK.
Adding new lambdas will be .net 7
[mono] Hot Reload: initial push to support adding lambdas (#63513)
lambdageek commentedon Jan 18, 2022
Adding new lambdas (either static lambdas that don't capture anything, or new lambdas that capture
thiswhen there is already at least one lambda that capturesthis, or lambdas that capture locals (as long as there's already at least one lambda that captures the same locals) will be supported in the first preview of .NET 7 (Fixed in #63513).Squashed commit of the following:
#51371 fixed failing test in iossimulator (#63877)