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

[net7 Preview1][hot reload] Adding new methods in blazor wasm asserts at debug-mono-ppdb.c:499 #65808

Closed
lambdageek opened this issue Feb 23, 2022 · 5 comments · Fixed by #65865
Assignees
Labels
area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc
Milestone

Comments

@lambdageek
Copy link
Member

Repro:

  1. Install .NET 7 Preview 1
  2. dotnet new blazorwasm
  3. dotnet build ; dotnet run ctrl-C
  4. dotnet watch
  5. Add this to Counter.razor:
        private static void Message(string msg)
        {
            Console.WriteLine(msg);
        }
    
    and call it from IncrementCount:
       private void IncrementCount()
        {
            Message ("clicked");
            currentCount++;
        }
    
  6. Save. dotnet watch says
       dotnet watch ⌚ File changed: ./Pages/Counter.razor.
       dotnet watch 🔥 Hot reload of changes succeeded.
    
  7. Click the button. Look at the JS Console:
dotnet.7.0.0-preview…6.8.47lt4znjjb.js:3 /__w/1/s/src/mono/mono/metadata/debug-mono-ppdb.c:499 <disabled>
mono_wasm_trace_logger	@	dotnet.7.0.0-preview…6.8.47lt4znjjb.js:3
_mono_wasm_trace_logger	@	dotnet.7.0.0-preview….8.47lt4znjjb.js:13
$func119	@	00978d7e:0x9788
$func2516	@	00978d7e:0xa315f
$func8431	@	00978d7e:0x1b8ecc
$func8432	@	00978d7e:0x1b8efd
$func8433	@	00978d7e:0x1b8f30
$func1073	@	00978d7e:0x59dd7
$func1886	@	00978d7e:0x8374b
$func336	@	00978d7e:0x1df3e
$func388	@	00978d7e:0x28b21
$func232	@	00978d7e:0x1a8d2
$func178	@	00978d7e:0x18c0e
$func177	@	00978d7e:0xbd23
$func7742	@	00978d7e:0x198018
$func1910	@	00978d7e:0x84364
$func1908	@	00978d7e:0x842d6
$func1272	@	00978d7e:0x65691
$func267	@	00978d7e:0x1b757
$func238	@	00978d7e:0x1ad99
$func178	@	00978d7e:0xce6d
$func177	@	00978d7e:0xbd23
$func7742	@	00978d7e:0x198018
$func1910	@	00978d7e:0x84364
$func1914	@	00978d7e:0x849d1
$mono_wasm_invoke_method	@	00978d7e:0x994f
Module._mono_wasm_invoke_method	@	dotnet.7.0.0-preview….8.47lt4znjjb.js:13
_Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet	@	_Microsoft_AspNetCor…eginInvokeDotNet:26
beginInvokeDotNetFromJS	@	blazor.webassembly.js:1
b	@	blazor.webassembly.js:1
invokeMethodAsync	@	blazor.webassembly.js:1
(anonymous)	@	blazor.webassembly.js:1
invokeWhenHeapUnlocked	@	blazor.webassembly.js:1
A	@	blazor.webassembly.js:1
_	@	blazor.webassembly.js:1
dispatchGlobalEventToAllElements	@	blazor.webassembly.js:1
onGlobalEvent
@dotnet-issue-labeler dotnet-issue-labeler bot added area-VM-meta-mono untriaged New issue has not been triaged by the area owner labels Feb 23, 2022
@lambdageek lambdageek added area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc and removed untriaged New issue has not been triaged by the area owner area-VM-meta-mono labels Feb 23, 2022
@lambdageek lambdageek self-assigned this Feb 23, 2022
@lambdageek lambdageek added this to the 7.0.0 milestone Feb 23, 2022
@lambdageek
Copy link
Member Author

It's a bad bounds check that isn't hot reload aware:

if (G_UNLIKELY (method_idx - 1 >= table_info_get_rows (methodbody_table))) {
char *method_name = mono_method_full_name (method, FALSE);
g_error ("Method idx %d is greater than number of rows (%d) in PPDB MethodDebugInformation table, for method %s in '%s'. Likely a malformed PDB file.",
method_idx - 1, table_info_get_rows (methodbody_table), method_name, image->name);
g_free (method_name);
}

The question is why wasn't htis caught in CI. and I think it's because my console tests for adding methods don't send PPDB deltas. So at least part of the work here is to update the test infra to send pdb deltas.

@lambdageek
Copy link
Member Author

Ah, we need the pdb delta, but we also need to set MONO_DEBUG=gen-seq-points (or attach a debugger)

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 24, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 25, 2022
@lambdageek
Copy link
Member Author

Trying the fix with a real Blazor app, doesn't seem to resolve it.

@lambdageek lambdageek reopened this Feb 25, 2022
@lambdageek
Copy link
Member Author

Ah, I see.
What seems to happen with blazor is that we get the initial baseline .pdb files (they're packed up as part of the debug build of a wasm app), but dotnet watch doesn't send us the deltas. But sequence points are enabled, after all, for some reason (need to track down where that's coming from).

So we end up doing a lookup for the EnC debug info, don't get any, and fall through to the baseline lookup, which asserts.

@lambdageek
Copy link
Member Author

Fixed by #65973 and #65867

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