diff --git a/CHANGELOG.md b/CHANGELOG.md index ae68fdbfdc..9cb5a0883e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixes +- MarshalManagedExceptionMode.Default is now used when capturing native exceptions in AOT compiled iOS applications, making native stack traces more readable ([#3912](https://github.com/getsentry/sentry-dotnet/pull/3912)) - Fixed duplicate SentryMauiEventProcessors ([#3905](https://github.com/getsentry/sentry-dotnet/pull/3905)) ### Dependencies diff --git a/src/Sentry.Bindings.Cocoa/buildTransitive/Sentry.Bindings.Cocoa.targets b/src/Sentry.Bindings.Cocoa/buildTransitive/Sentry.Bindings.Cocoa.targets index 4b74ad10fe..6e929b5136 100644 --- a/src/Sentry.Bindings.Cocoa/buildTransitive/Sentry.Bindings.Cocoa.targets +++ b/src/Sentry.Bindings.Cocoa/buildTransitive/Sentry.Bindings.Cocoa.targets @@ -49,4 +49,15 @@ + + + --marshal-managed-exceptions=unwindnativecode + + diff --git a/src/Sentry/Platforms/Cocoa/SentrySdk.cs b/src/Sentry/Platforms/Cocoa/SentrySdk.cs index c7b438f12d..bf2feb5744 100644 --- a/src/Sentry/Platforms/Cocoa/SentrySdk.cs +++ b/src/Sentry/Platforms/Cocoa/SentrySdk.cs @@ -1,6 +1,8 @@ using Sentry.Cocoa; using Sentry.Cocoa.Extensions; using Sentry.Extensibility; +using Sentry.Internal; +using Sentry.PlatformAbstractions; // ReSharper disable once CheckNamespace namespace Sentry; @@ -10,10 +12,10 @@ public static partial class SentrySdk private static void InitSentryCocoaSdk(SentryOptions options) { options.LogDebug("Initializing native SDK"); - // Workaround for https://github.com/xamarin/xamarin-macios/issues/15252 ObjCRuntime.Runtime.MarshalManagedException += (_, args) => { - args.ExceptionMode = ObjCRuntime.MarshalManagedExceptionMode.UnwindNativeCode; + // This MAY be overriden in Sentry.Bindings.Cocoa.targets + options.LogDebug($"MarshalManagedExceptionMode: {args.ExceptionMode}"); }; // Set default release and distribution