getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
578 stars 206 forks source link

Blazor publish fails when using profiling #3523

Open klemmchr opened 1 month ago

klemmchr commented 1 month ago

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]
bitsandfoxes commented 1 month ago

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!

klemmchr commented 2 weeks ago

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.

jamescrosswell commented 2 weeks ago

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.

klemmchr commented 2 weeks ago

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