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 - WebAssembly build_id section #91049

Open
1 task done
bruno-garcia opened this issue Aug 23, 2023 · 15 comments
Open
1 task done

Blazor - WebAssembly build_id section #91049

bruno-garcia opened this issue Aug 23, 2023 · 15 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-Diagnostics-mono area-VM-meta-mono enhancement Product code improvement that does NOT require public API changes/additions os-browser Browser variant of arch-wasm
Milestone

Comments

@bruno-garcia
Copy link
Member

bruno-garcia commented Aug 23, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Production stack traces are hard to debug:

    at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.7.0.10.hef7nl7p9e.js:14:103886)
    at wasm://wasm/009931b2:wasm-function[313]:0x1d6b6
    at wasm://wasm/009931b2:wasm-function[283]:0x1cae4
    at wasm://wasm/009931b2:wasm-function[221]:0xe1d4
    at wasm://wasm/009931b2:wasm-function[220]:0xd044
    at wasm://wasm/009931b2:wasm-function[8115]:0x1a2377
    at wasm://wasm/009931b2:wasm-function[2040]:0x85b46
    at wasm://wasm/009931b2:wasm-function[2038]:0x85abc
    at wasm://wasm/009931b2:wasm-function[1395]:0x6889a
    at wasm://wasm/009931b2:wasm-function[313]:0x1d66f
    at wasm://wasm/009931b2:wasm-function[283]:0x1cae4
    at wasm://wasm/009931b2:wasm-function[221]:0xe1d4
    at wasm://wasm/009931b2:wasm-function[220]:0xd044
    at wasm://wasm/009931b2:wasm-function[8115]:0x1a2377
    at wasm://wasm/009931b2:wasm-function[2040]:0x85b46
    at wasm://wasm/009931b2:wasm-function[2045]:0x861ae
    at wasm://wasm/009931b2:wasm-function[2072]:0x8826d
    at wasm://wasm/009931b2:wasm-function[114]:0x9d80

Tools like Sentry support several debug file format. Including DWARF, PDB, Portable PDBs, etc.
It also supports Wasm DWARF but it requires a way to identify the wasm modules at runtime. It has a JavaScript integration that patches things at runtime in order to collect the loaded modules. And with that it can load debug files when events come into the service.

Patching the wasm with a debug id after the fact breaks ASP.NET's ability to check for integrity, forcing the user to abandon it through BlazorCacheBootResources set to false.

Describe the solution you'd like

Attach a section called debug_id in the .NET wasm module :

https://docs.sentry.io/platforms/native/guides/wasm/data-management/debug-files/identifiers/#wasm-build-ids

This way crash reporting tools can build integrations for Blazor to have better debuggability for production builds.

https://github.com/WebAssembly/tool-conventions/pull/183/files

Additional context

No response

@bruno-garcia bruno-garcia changed the title Blazor - WebAssembly debug id Blazor - WebAssembly build_id section Aug 23, 2023
@bruno-garcia
Copy link
Member Author

Just realized perhaps this belongs in dotnet/runtime?

@javiercn javiercn transferred this issue from dotnet/aspnetcore Aug 24, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 24, 2023
@SamMonoRT SamMonoRT added the arch-wasm WebAssembly architecture label Aug 24, 2023
@ghost
Copy link

ghost commented Aug 24, 2023

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

Issue Details

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Production stack traces are hard to debug:

    at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.7.0.10.hef7nl7p9e.js:14:103886)
    at wasm://wasm/009931b2:wasm-function[313]:0x1d6b6
    at wasm://wasm/009931b2:wasm-function[283]:0x1cae4
    at wasm://wasm/009931b2:wasm-function[221]:0xe1d4
    at wasm://wasm/009931b2:wasm-function[220]:0xd044
    at wasm://wasm/009931b2:wasm-function[8115]:0x1a2377
    at wasm://wasm/009931b2:wasm-function[2040]:0x85b46
    at wasm://wasm/009931b2:wasm-function[2038]:0x85abc
    at wasm://wasm/009931b2:wasm-function[1395]:0x6889a
    at wasm://wasm/009931b2:wasm-function[313]:0x1d66f
    at wasm://wasm/009931b2:wasm-function[283]:0x1cae4
    at wasm://wasm/009931b2:wasm-function[221]:0xe1d4
    at wasm://wasm/009931b2:wasm-function[220]:0xd044
    at wasm://wasm/009931b2:wasm-function[8115]:0x1a2377
    at wasm://wasm/009931b2:wasm-function[2040]:0x85b46
    at wasm://wasm/009931b2:wasm-function[2045]:0x861ae
    at wasm://wasm/009931b2:wasm-function[2072]:0x8826d
    at wasm://wasm/009931b2:wasm-function[114]:0x9d80

Tools like Sentry support several debug file format. Including DWARF, PDB, Portable PDBs, etc.
It also supports Wasm DWARF but it requires a way to identify the wasm modules at runtime. It has a JavaScript integration that patches things at runtime in order to collect the loaded modules. And with that it can load debug files when events come into the service.

Patching the wasm with a debug id after the fact breaks ASP.NET's ability to check for integrity, forcing the user to abandon it through BlazorCacheBootResources set to false.

Describe the solution you'd like

Attach a section called debug_id in the .NET wasm module :

https://docs.sentry.io/platforms/native/guides/wasm/data-management/debug-files/identifiers/#wasm-build-ids

This way crash reporting tools can build integrations for Blazor to have better debuggability for production builds.

https://github.com/WebAssembly/tool-conventions/pull/183/files

Additional context

No response

Author: bruno-garcia
Assignees: -
Labels:

arch-wasm, untriaged, area-VM-meta-mono

Milestone: -

@SamMonoRT
Copy link
Member

/cc @maraf @pavelsavara - please triage this issue, and set milestone accordingly.

@pavelsavara pavelsavara added the os-browser Browser variant of arch-wasm label Aug 24, 2023
@pavelsavara pavelsavara added this to the 9.0.0 milestone Aug 24, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Aug 24, 2023
@pavelsavara
Copy link
Member

Related WebAssembly/tool-conventions#133

@pavelsavara
Copy link
Member

Note that the stack above is most likely C code of the MonoVM and it's interpreter.
Looking at it's DWARF would not help you understanding the managed stack trace.

@bruno-garcia
Copy link
Member Author

bruno-garcia commented Aug 25, 2023

That's fair. I truncated off the C# code from the stack trace in this example. And it's true this was running in the interpreter. And I'm more interested in production environments so not really the interpreter. What I'm after is being able to map every frame back to something in its original form. App and "System" frames that is. I understand that might require going through DWARF for some native frames, and perhaps Portable PDB for some managed frames (at least to get line numbers in release builds, which we do already for normal .NET JIT workloads when users upload PDBs).

@pavelsavara
Copy link
Member

Is there LLVM/emcc support for the build_id section already ?

@bruno-garcia
Copy link
Member Author

Is there LLVM/emcc support for the build_id section already ?

I believe so: https://reviews.llvm.org/D107662

@bitsandfoxes
Copy link

Hey, we're looking into improving the Blazor debugability. Is there any update on this?

@pavelsavara
Copy link
Member

It seems LLVM now has --build-id flag.

@lewing
Copy link
Member

lewing commented Jul 30, 2024

@thaystg we should discuss what we can do

@lewing lewing modified the milestones: 9.0.0, 10.0.0 Jul 30, 2024
@pavelsavara
Copy link
Member

  • any native build (with workload) can do it
    • it needs to be native build on customer machine, otherwise all users will have same dotnet.wasm binary with same id that we calculated during runtime build
    • the default value could be new GUID
  • we could add optional MSbuild property, for user to override the value
    • it would trigger native build if passed

maybe WasmNativeBuildId

@pavelsavara
Copy link
Member

and we could also expose that ID on JavaScript runtimeBuildInfo API

@bruno-garcia
Copy link
Member Author

Any updates on this one? I imagine for .NET 9 it's too late, but perhaps we get this going for .NET 10?

Would be great to have full/proper stack trace for production exception with server side symbolication so app deployments can be small/optimized and developers can have good debugging tools in production

@pavelsavara
Copy link
Member

@tommcdon tommcdon added the enhancement Product code improvement that does NOT require public API changes/additions label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Diagnostics-mono area-VM-meta-mono enhancement Product code improvement that does NOT require public API changes/additions os-browser Browser variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

7 participants