sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Blazor publish fails when using profiling

Open klemmchr opened this issue 1 year ago • 5 comments
trafficstars

Package

Sentry

.NET Flavor

.NET

.NET Version

8.0.0

OS

Browser

SDK Version

4.9.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

Add Profiling to a Sentry application and publish it with AOT enabled

Expected Result

Build suceeds

Actual Result

Build fails with an error during precompiling

21:39:54 [ERR] /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.7/Sdk/WasmApp.Native.targets(686,5): error : Precompiling failed for /builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/obj/Release/linked/Microsoft.Diagnostics.Tracing.TraceEvent.dll with exit code 1. [/builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/Web.Blazor.csproj]
21:39:54 [ERR] /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.7/Sdk/WasmApp.Native.targets(686,5): error : Mono Ahead of Time compiler - compiling assembly /builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/obj/Release/linked/Microsoft.Diagnostics.Tracing.TraceEvent.dll [/builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/Web.Blazor.csproj]
21:39:54 [ERR] /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.7/Sdk/WasmApp.Native.targets(686,5): error : Failed to load method 0x600001a from '/builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/obj/Release/linked/Microsoft.Diagnostics.Tracing.TraceEvent.dll' due to Could not load file or assembly 'Dia2Lib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.. [/builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/Web.Blazor.csproj]
21:39:54 [ERR] /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.7/Sdk/WasmApp.Native.targets(686,5): error : Run with MONO_LOG_LEVEL=debug for more information. [/builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/Web.Blazor.csproj]
21:39:54 [ERR] /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.7/Sdk/WasmApp.Native.targets(686,5): error : AOT of image /builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/obj/Release/linked/Microsoft.Diagnostics.Tracing.TraceEvent.dll failed. [/builds/xxxxxxxxx/xxxxxxxxx/src/Web/Web.Blazor/Web.Blazor.csproj]

klemmchr avatar Aug 05 '24 22:08 klemmchr

Oof, I don't think we ever tested profiling in conjunction with Blazor. That's something we might be able to cover via our samples tho. Thanks for reporting this!

bitsandfoxes avatar Aug 12 '24 16:08 bitsandfoxes

One small note regarding profiling and Blazor: Blazor runs single threaded so if profiling needs another thread for some background jobs this will not be supported until .NET 9 ships.

klemmchr avatar Aug 26 '24 14:08 klemmchr

One small note regarding profiling and Blazor: Blazor runs single threaded so if profiling needs another thread for some background jobs this will not be supported until .NET 9 ships.

@klemmchr I take it you're talking about Blazor WebAssembly here, so you're wanting to profile WebAssembly UI applications running in the browser? A lot of the profiling code is unmanaged code (basically C) so I'm not sure how well this will translate to WebAssembly.

jamescrosswell avatar Aug 26 '24 21:08 jamescrosswell

Oh yeah then this is another hurdle for profiling in Blazor WebAssembly.

klemmchr avatar Aug 26 '24 22:08 klemmchr

looks like we'll have .NET profiling on wasm too from .NET 10

  • https://github.com/dotnet/runtime/issues/76316#issuecomment-2662463594

https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-10.0?view=aspnetcore-9.0#blazor-webassembly-perfo[…]g-and-diagnostic-counters

bruno-garcia avatar May 13 '25 21:05 bruno-garcia

I've made another issue regarding Blazor WebAssembly profiling support:

  • https://github.com/getsentry/sentry-dotnet/issues/4506

alexsohn1126 avatar Sep 09 '25 17:09 alexsohn1126