Skip to content

System.ExecutionEngineException: Attempting to JIT compile method when running app thru TestFlight #4178

@ssbssb-cmd

Description

@ssbssb-cmd

Package

Sentry.Maui

.NET Flavor

.NET

.NET Version

9.0.203

OS

iOS

OS Version

18.4.1

Development Environment

Rider 2024 (MacOS)

SDK Version

5.6.0

Self-Hosted Sentry Version

No response

Workload Versions

Installed Workload Id Manifest Version Installation Source

maui 9.0.14/9.0.100 SDK 9.0.200
maui-android 9.0.14/9.0.100 SDK 9.0.200
maui-ios 9.0.14/9.0.100 SDK 9.0.200

UseSentry or SentrySdk.Init call

UseSentry(options => {
            options.Dsn = "https://server/";
            #if IOS
            options.Native.EnableAppHangTracking = false;
            #endif
                
            options.SetBeforeSend((sentryEvent, hint) =>
            {
                var ex = sentryEvent.Exception;
                if (ex != null)
                {
                    // Filter out known noisy exception types
                    if (ex is OperationCanceledException ||
                        ex is TaskCanceledException ||
                        ex is System.IO.FileNotFoundException)
                    {
                        return null;
                    }

#if ANDROID
                    if (ex is Java.Lang.IllegalArgumentException ||
                        ex is Java.Lang.NullPointerException)
                    {
                        return null;
                    }
#endif

                    // Filter out exceptions by message content
                    var msg = ex.Message ?? "";
                    if (msg.Contains("BindingContext not set") ||
                        msg.Contains("Hot reload") ||
                        msg.Contains("No default constructor found") ||
                        msg.Contains("App hanging", StringComparison.OrdinalIgnoreCase)
                        )
                    {
                        return null;
                    }
                }

                // Optional: strip sensitive info
                sentryEvent.ServerName = null;

                return sentryEvent;
            });

`

Steps to Reproduce

  1. open the app from TestFlight

Expected Result

  1. the app runs and doesn't crash

Actual Result

When running the app in release mode via Rider on device - it is fine.

I have sent the app to App Store - Distribution and the same build to App Store - Test Flight. Apple seem to have approved the app for distribution (so i presume it does not crash there ?).

When launching the build from Test Flight, the app crashes on launch and i get the below show up in Sentry logs.

Not sure if this is TestFlight issue (that would be odd?) - The app is in Pending Developer Release state, but i don't want to release it to the app store if it will then start crashing on launch.

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper dynamic-method) object object:InvokeStub_SafeDigestCtxHandle..ctor (object,object,intptr*)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
(System.ExecutionEngineException)
at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure, Boolean allowClosed)
at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type , Object )
at System.Reflection.InvokerEmitUtil.CreateInvokeDelegate_RefArgs(MethodBase , Boolean )
at System.Reflection.MethodInvokerCommon.DetermineStrategy_RefArgs(InvokerStrategy& , InvokeFunc_RefArgs& , MethodBase , Boolean )
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object , BindingFlags )
at System.RuntimeType.CreateInstanceMono(Boolean , Boolean )
at System.Activator.CreateInstanceSafeDigestCtxHandle
at System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller`1.ManagedToUnmanagedOut[[System.Security.Cryptography.Apple.SafeDigestCtxHandle, System.Security.Cryptography, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]..ctor()
at Interop.AppleCrypto.DigestCreate(PAL_HashAlgorithm , Int32& )
at System.Security.Cryptography.LiteHash..ctor(PAL_HashAlgorithm )
at System.Security.Cryptography.HashProviderDispenser.CreateHashProvider(String )
at System.Security.Cryptography.SHA1.Implementation..ctor()
at System.Security.Cryptography.SHA1.Create()
at Sentry.Internal.Extensions.HashExtensions.GetHashString(String , Boolean )
at Sentry.SentryOptions.TryGetDsnSpecificCacheDirectoryPath()
at Sentry.Internal.Http.CachingTransport..ctor(ITransport , SentryOptions , Boolean )
at Sentry.Internal.Http.CachingTransport.Create(ITransport , SentryOptions , Boolean , Boolean )
at Sentry.Internal.SdkComposer.CreateTransport()
at Sentry.Internal.SdkComposer.CreateBackgroundWorker()
at Sentry.SentryClient..ctor(SentryOptions , IBackgroundWorker , RandomValuesFactory , ISessionManager )
at Sentry.Internal.Hub..ctor(SentryOptions , ISentryClient , ISessionManager , ISystemClock , IInternalScopeManager , RandomValuesFactory )
at Sentry.SentrySdk.InitHub(SentryOptions )
at Sentry.SentrySdk.Init(SentryOptions )
at Sentry.Maui.Internal.SentryMauiInitializer.Initialize(IServiceProvider services)
at Microsoft.Maui.MauiContextExtensions.InitializeAppServices(MauiApp mauiApp)
at Microsoft.Maui.Hosting.MauiAppBuilder.Build()
at MyApp.MauiProgram.CreateMauiApp()
at MyApp.AppDelegate.CreateMauiApp()
at Microsoft.Maui.MauiUIApplicationDelegate.WillFinishLaunching(UIApplication application, NSDictionary launchOptions)
at Microsoft.Maui.MauiUIApplicationDelegate.Registrar_Callbacks.callback_812_Microsoft_Maui_MauiUIApplicationDelegate_WillFinishLaunching(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr p1, IntPtr* exception_gchandle)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions