getsentry / sentry-dotnet

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

Sentry.Maui package causes Unhandled Exception in .NET MAUI WinUI application #3706

Open luminixinc opened 2 weeks ago

luminixinc commented 2 weeks ago

Package

Sentry.Maui

.NET Flavor

.NET

.NET Version

8.0

OS

Windows

SDK Version

4.12.1

Self-Hosted Sentry Version

No response

Steps to Reproduce

We have created a reduced test case that demonstrates the problem. See https://github.com/luminixinc/NetMauiWinUI_SentryMaui

Expected Result

I expected to be able to run the simple application and see the MainPage with waving dotnet bot and the extra button that calls SentrySdk.CaptureMessage

Actual Result

Unhandled exception {"Could not load file or assembly 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709'. The system cannot find the file specified.":"WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709"}

See reduced test case that demonstrates the issue at https://github.com/luminixinc/NetMauiWinUI_SentryMaui

bricefriha commented 2 weeks ago

@luminixinc thanks for reporting this.

I ran the app from the repo you provided. Unfortunately, I'm unable to reproduce the issue. I can run the app, click the button, and see the message captured on Sentry without exception. Image

I tried with both our DSN and yours (you should be able to see the item on the issues tab on Sentry on your hand as well).

Unhandled exception {"Could not load file or assembly 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709'. The system cannot find the file specified.":"WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709"}

Additionally, this message indicates that WinRT.Runtime is missing. So, it's unlikely related to the Sentry SDK.

Is there any other info that would help reproduce this issue?

CyborgDE commented 4 days ago

Hello, I have the same issue with Versions greater 4.12.0. 4.12.0 is OK ...

bricefriha commented 4 days ago

Thanks @CyborgDE

I'm gonna investigate further, especially on 4.12.1; if it's on this version, it may be related to #3655 according to the change logs

jamescrosswell commented 1 day ago

Thanks @CyborgDE

I'm gonna investigate further, especially on 4.12.1; if it's on this version, it may be related to #3655 according to the change logs

I don't think that change is related. WinRT.Runtime doesn't have anything to do with Utf8JsonWriter.