-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Sentry.MAUI crashing when launching #3235
Comments
MacOS version: |
Thanks for reaching out. I'll be giving this a try locally. |
If needed, below is the reproduced example. |
Hi @Curs3W4ll , I tried this myself with a new MAUI project (in Rider) and also tried opening/running the example that you provided but was unable to reproduce the issue. In both cases, the application runs fine for me. From the logs, it looked like you were trying to run the MAUI application using macCatalyst, which is also what I tried. The only thing I did have to change in the project (simply to get it to run) was to comment out this line in your <!-- <RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>--> |
Hey @jamescrosswell I changed it, but it is still crashing. I have the same error on another MacOS machine, with the same version. PS: I tried with .net 8, and there is no issue. |
OK... that was it. I was running macOS 14.2.1 (23C71). After upgrading to 14.4.1 I'm able to reproduce... now just a matter of working out why. |
If I'm reading the crash report that I'm getting correctly, the error seems to happen as a result of a call to @bitsandfoxes I'm not sure how we dig into that further though. Are you able to check with the cocoa folks to see if this is something they've seen already (seems to relate to some change that was made with one of the most recent releases of macOS - possibly 14.4.1 but I skipped a few versions so it could have been anything after 14.2.1 afaik). Here are the frames I'm seeing on the crashed thread:
|
Hi @philipphofmann , sure @Curs3W4ll already provided one here actually. To run that in a debugger and be able to add logging code etc., I've:
You should then be able to run that At this stage you should be able to reproduce the issue in your debugger - it happens as soon as the application launches. Once you can build/run from our source code, it's then possible to fiddle with the sentry-cocoa souce code. We've included that in the .NET project as a git submodule, so you'll find that in the The Cocoa module itself is built automatically as part of the .NET Build process: sentry-dotnet/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj Lines 47 to 54 in ea5dddc
One gotcha is that we only recompile the sentry-cocoa SDK if the commit hash for that submodule has changed. The hash itself is written/cached in |
Thanks. I'm on PTO next week, so I will only look at this around April 22nd. |
This is caused by a bug in the .NET runtime; see dotnet/runtime#98941. I tried to use a different date formatter |
Fantastic, thanks @philipphofmann ! That's hopefully enough options to unblock SDK customers experiencing this problem while we're waiting for a fix in the dotnet runtime:
I tried that workaround and can confirm it works with Sentry. |
<_MonoRuntimeComponentLinking Remove="dynamic" /> <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="ios-arm64" /> <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="iossimulator-arm64" /> <_MonoRuntimeComponentLinking Include="static" RuntimeIdentifier="iossimulator-x64" />
So, to confirm, we should put this in our MAUI Project ? |
@Kylar182 I think the code got mangled when you copied/pasted it but assuming you meant the code sample I linked to in this comment then yes, that would permit you to test on iOS17.4 simulators until this bug gets fixed in the dotnet runtime. This workaround isn't necessary if you're testing on iOS17.2 or on physical devices. |
Can we put the workaround into the SDK? Sounds hacky if we even should. |
But hey! Looks like upgrading to |
Yeah it's fixed in .NET 8.0.5 but my projects are still on .NET 6 for the time being. Also, the issue posts as being on the iOS simulators but its everything on MacOS including the .NET MAUI MacOS Release Apps so please be aware of that. |
Closing this as bumping to the most current version of .NET resolves the crashing. |
Where did you find .NET 8.0.5? I am seeing .NET 8.0.302 as latest. It still crashes in 8.0.302 with the original error |
Based on dotnet/runtime#98941 (comment) this should contain the fix. |
System.Exception: Could not create an native instance of the type 'Sentry.CocoaSdk.SentryOptions': the native class hasn't been loaded. |
@BoodyAna what version of .NET are you targeting? |
. Net 8.404
…On Sun, 5 Jan 2025, 11:41 pm James Crosswell, ***@***.***> wrote:
@BoodyAna <https://github.com/BoodyAna> what version of .NET are you
targeting?
—
Reply to this email directly, view it on GitHub
<#3235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQV26WTJMVUI4L3KVSN27HD2JGRKNAVCNFSM6AAAAABUJDB7S6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZRG42TSNJWGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Very strange. This should have been fixed in the runtime. Potentially you could try upgrading to net9.0 (you'd want to bump to Sentry version 5.0.0 in that case). Alternatively you could try one of the workarounds described here. |
Iam already using version 5.0.0 from sentry
…On Mon, 6 Jan 2025, 2:18 am James Crosswell, ***@***.***> wrote:
. Net 8.404
Very strange. This should have been fixed in the runtime.
Potentially you could try upgrading to net9.0 (you'd want to bump to
Sentry version 5.0.0 in that case).
Alternatively you could try one of the workarounds described here
<#3235 (comment)>
.
—
Reply to this email directly, view it on GitHub
<#3235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQV26WXMPG5HEDIHDR44VX32JHDV3AVCNFSM6AAAAABUJDB7S6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZRHAYDQNBZGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
OK, you should be able to target net9.0 without any issues then. |
Package
Sentry.Maui
.NET Flavor
Xamarin
.NET Version
7.0.407
OS
macOS
SDK Version
4.2.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
MauiProgram.cs
Expected Result
The app is launching and logging into Sentry
Actual Result
The app is crashing, below error details
The text was updated successfully, but these errors were encountered: