Skip to content

(MAUI) Crash caused by setEnableAppHangTrackingV2 on iOS simulator #4191

@BjoernMSG

Description

@BjoernMSG

Package

Sentry.Maui

.NET Flavor

.NET

.NET Version

9.0.202

OS

iOS

OS Version

No response

Development Environment

Rider 2024 (MacOS)

SDK Version

5.6.0

Self-Hosted Sentry Version

No response

Workload Versions

Image

UseSentry or SentrySdk.Init call

    // This adds Sentry to your Maui application
    builder.UseSentry(options =>
    {
        // Use based on the current selected build config (not log environment!) the project DSN on sentry.io
        // DEBUG should be used to try out changes in the Logging Library itself

#if DEBUG
// dsn for logging-sandbox on sentry
options.Dsn = SentryIoConfiguration.SandboxDsn;
#else
// dsn for miele-app on sentry
options.Dsn = SentryIoConfiguration.MieleAppDsn;
#endif

        // By default, we will send the last 100 breadcrumbs with each event.
        options.MaxBreadcrumbs = 100;

        // This option is recommended. It enables Sentry's "Release Health" feature.
        options.AutoSessionTracking = true;

        // Enabling this option is recommended for client applications only. It ensures all threads use the same global scope.
        options.IsGlobalModeEnabled = true;

        // This feature automatically captures HTTP client errors, like bad response codes, as error events and reports them to Sentry.
        options.CaptureFailedRequests = true;

        // Don't send PII like the username of the user logged in to the device
        options.SendDefaultPii = false;

        // Initialize the sentry SDK from here (in contrast to the initialization from the Serilog intergration!)
        options.InitializeSdk = true;

        // Mark listed namespaces as "InApp" in sentry web ui
        options.AddInAppInclude("Miele");

        // Include async, return type, arguments, and more.
        options.StackTraceMode = StackTraceMode.Enhanced;

        // Use the provided log environment to separate issues in sentry
        // By default, the SDK reports debug when the debugger is attached. Otherwise, the default environment is production.
        options.Environment = logEnvironment.ToString().ToLowerInvariant();

        // The default is 1.0 which means that 100 % of error events are sent.
        options.SampleRate = 1.0f;

        // This option will enable Sentry's tracing features. You still need to start transactions and spans.
        options.TracesSampleRate = (logEnvironment == LogEnvironment.AppStore) ? 0.25f : 1.0f; // recommended default of 1.0

        // We don't use sensitive information in page titles
        options.IncludeTitleInBreadcrumbs = true;

        // Text information can lead to PII to be send
        options.IncludeTextInBreadcrumbs = false;

        // Add information about going to the background and foreground as well
        options.IncludeBackgroundingStateInBreadcrumbs = true;

        // Add breadcrumbs with the log level information to events
        options.MinimumBreadcrumbLevel = LogLevel.Information;

        // Only send events with the log level error or above
        options.MinimumEventLevel = LogLevel.Critical;

#if ANDROID
// Suppress native SIGSEGV Segfault errors on Android, see #3903 for details
options.Android.SuppressSegfaults = true;
#endif
});

Steps to Reproduce

  • Just start the app with Sentry on iOS simulator (tested on ios 18.1 and 18.4). On real it seems to work
  • App will crash

Expected Result

No crash or exception is raised on simulator or real device

Actual Result

App crash with the following call stack:

ObjCRuntime.ObjCException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[SentryOptions setEnableAppHangTrackingV2:]: unrecognized selector sent to instance 0x7f8e6413a340
Native stack trace:
0 CoreFoundation 0x00000001107a995d __exceptionPreprocess + 242
1 libobjc.A.dylib 0x000000011bf47116 objc_exception_throw + 62
2 CoreFoundation 0x00000001107bf45e +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00000001107ae2c0 forwarding + 1459
4 CoreFoundation 0x00000001107b0678 _CF_forwarding_prep_0 + 120
5 libxamarin-dotnet-debug.dylib 0x0000000109fb4f29 xamarin_dyn_objc_msgSend + 217
6 ??? 0x00000001749adea7 0x0 + 6251273895
7 libmonosgen-2.0.dylib 0x000000010b903760 ves_pinvoke_method + 544
8 libmonosgen-2.0.dylib 0x000000010b8f4221 mono_interp_exec_method + 4609
9 libmonosgen-2.0.dylib 0x000000010b8f17b4 interp_runtime_invoke + 260
10 libmonosgen-2.0.dylib 0x000000010b9d00c7 mono_runtime_invoke_checked + 135
11 libmonosgen-2.0.dylib 0x000000010b9d3dc8 mono_runtime_invoke + 552
12 libxamarin-dotnet-debug.dylib 0x0000000109fac1fc xamarin_invoke_trampoline + 6460
13 libxamarin-dotnet-debug.dylib 0x0000000109fb3bc9 xamarin_arch_trampoline + 105
14 libxamarin-dotnet-debug.dylib 0x0000000109fb4daa xamarin_x86_64_common_trampoline + 118
15 UIKitCore 0x00000001516a2d3a -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 184
16 UIKitCore 0x00000001516a4cae -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4555
17 UIKitCore 0x00000001516aae36 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1346
18 UIKitCore 0x0000000150904332 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
19 UIKitCore 0x00000001510a2fee _UIScenePerformActionsWithLifecycleActionMask + 87
20 UIKitCore 0x0000000150904e88 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
21 UIKitCore 0x00000001509048ed -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 245
22 UIKitCore 0x0000000150904cd1 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 813
23 UIKitCore 0x0000000150904505 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 341
24 UIKitCore 0x0000000150912b57 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 174
25 UIKitCore 0x0000000150f3ed2a +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 865
26 UIKitCore 0x00000001510c4450 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 261
27 UIKitCore 0x00000001509127e6 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 347
28 UIKitCore 0x00000001506bf52a __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.615 + 877
29 UIKitCore 0x00000001506bded9 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 246
30 UIKitCore 0x00000001506bf092 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 252
31 UIKitCore 0x00000001516a962d -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 587
32 UIKitCore 0x0000000150f773fb -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 353
33 FrontBoardServices 0x000000012f47b261 __95-[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]_block_invoke + 301
34 FrontBoardServices 0x000000012f47b805 -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:] + 44
35 FrontBoardServices 0x000000012f47b0c7 -[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:] + 561
36 FrontBoardServices 0x000000012f4b3802 __93-[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]_block_invoke.342 + 269
37 FrontBoardServices 0x000000012f48b27b -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 213
38 FrontBoardServices 0x000000012f4b1792 -[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:] + 540
39 libdispatch.dylib 0x0000000123012563 _dispatch_client_callout + 8
40 libdispatch.dylib 0x000000012301602f _dispatch_block_invoke_direct + 475
41 FrontBoardServices 0x000000012f4ded8c FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30
42 FrontBoardServices 0x000000012f4dec66 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 188
43 FrontBoardServices 0x000000012f4dedb4 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 19
44 CoreFoundation 0x0000000110708e54 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
45 CoreFoundation 0x0000000110708d96 __CFRunLoopDoSource0 + 157
46 CoreFoundation 0x00000001107085f5 __CFRunLoopDoSources0 + 293
47 CoreFoundation 0x0000000110702ad2 __CFRunLoopRun + 960
48 CoreFoundation 0x00000001107022d1 CFRunLoopRunSpecific + 550
49 GraphicsServices 0x000000012f95c0cb GSEventRunModal + 137
50 UIKitCore 0x00000001516a7490 -[UIApplication _run] + 875
51 UIKitCore 0x00000001516ac3d1 UIApplicationMain + 123
52 libxamarin-dotnet-debug.dylib 0x0000000109f732ba xamarin_UIApplicationMain + 58
53 libmonosgen-2.0.dylib 0x000000010b904e7c do_icall + 348
54 libmonosgen-2.0.dylib 0x000000010b903407 do_icall_wrapper + 295
55 libmonosgen-2.0.dylib 0x000000010b8f40eb mono_interp_exec_method + 4299
56 libmonosgen-2.0.dylib 0x000000010b8f17b4 interp_runtime_invoke + 260
57 libmonosgen-2.0.dylib 0x000000010b9d00c7 mono_runtime_invoke_checked + 135
58 libmonosgen-2.0.dylib 0x000000010b9d72d5 mono_runtime_exec_main_checked + 117
59 libmonosgen-2.0.dylib 0x000000010b84d886 mono_jit_exec + 358
60 libxamarin-dotnet-debug.dylib 0x0000000109fb3a5a xamarin_main + 1898
61 Miele.App.Domestic 0x00000001003640d4 main + 52
62 dyld 0x0000000108e3e478 start_sim + 10
63 ??? 0x00000002009dc2cd 0x0 + 8600273613

at Sentry.CocoaSdk.SentryOptions.set_EnableAppHangTrackingV2(Boolean value)
at Sentry.SentrySdk.InitSentryCocoaSdk(SentryOptions options)
at Sentry.SentrySdk.InitHub(SentryOptions options)
at Sentry.SentrySdk.Init(SentryOptions options)
at Sentry.Maui.Internal.SentryMauiInitializer.Initialize(IServiceProvider services)
at Microsoft.Maui.MauiContextExtensions.InitializeAppServices(MauiApp mauiApp)
at Microsoft.Maui.Hosting.MauiAppBuilder.Build()
at Miele.App.Domestic.MauiProgram.CreateMauiApp() in /Users/dreheb/Source/App.Domestic/src/Domestic/MauiProgram.cs:line 112
at Miele.App.Domestic.iOS.AppDelegate.CreateMauiApp() in /Users/dreheb/Source/App.Domestic/src/Domestic/Platforms/iOS/AppDelegate.cs:line 31
at Microsoft.Maui.MauiUIApplicationDelegate.WillFinishLaunching(UIApplication application, NSDictionary launchOptions)
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 61
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 96
at Miele.App.Domestic.iOS.Program.Main(String[] args) in /Users/dreheb/Source/App.Domestic/src/Domestic/Platforms/iOS/Program.cs:line 12
Native stack trace:
0 CoreFoundation 0x00000001107a995d __exceptionPreprocess + 242
1 libobjc.A.dylib 0x000000011bf47116 objc_exception_throw + 62
2 CoreFoundation 0x00000001107bf45e +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00000001107ae2c0 forwarding + 1459
4 CoreFoundation 0x00000001107b0678 _CF_forwarding_prep_0 + 120
5 libxamarin-dotnet-debug.dylib 0x0000000109fb4f29 xamarin_dyn_objc_msgSend + 217
6 ??? 0x00000001749adea7 0x0 + 6251273895
7 libmonosgen-2.0.dylib 0x000000010b903760 ves_pinvoke_method + 544
8 libmonosgen-2.0.dylib 0x000000010b8f4221 mono_interp_exec_method + 4609
9 libmonosgen-2.0.dylib 0x000000010b8f17b4 interp_runtime_invoke + 260
10 libmonosgen-2.0.dylib 0x000000010b9d00c7 mono_runtime_invoke_checked + 135
11 libmonosgen-2.0.dylib 0x000000010b9d3dc8 mono_runtime_invoke + 552
12 libxamarin-dotnet-debug.dylib 0x0000000109fac1fc xamarin_invoke_trampoline + 6460
13 libxamarin-dotnet-debug.dylib 0x0000000109fb3bc9 xamarin_arch_trampoline + 105
14 libxamarin-dotnet-debug.dylib 0x0000000109fb4daa xamarin_x86_64_common_trampoline + 118
15 UIKitCore 0x00000001516a2d3a -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 184
16 UIKitCore 0x00000001516a4cae -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4555
17 UIKitCore 0x00000001516aae36 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1346
18 UIKitCore 0x0000000150904332 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
19 UIKitCore 0x00000001510a2fee _UIScenePerformActionsWithLifecycleActionMask + 87
20 UIKitCore 0x0000000150904e88 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
21 UIKitCore 0x00000001509048ed -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 245
22 UIKitCore 0x0000000150904cd1 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 813
23 UIKitCore 0x0000000150904505 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 341
24 UIKitCore 0x0000000150912b57 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 174
25 UIKitCore 0x0000000150f3ed2a +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 865
26 UIKitCore 0x00000001510c4450 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 261
27 UIKitCore 0x00000001509127e6 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 347
28 UIKitCore 0x00000001506bf52a __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.615 + 877
29 UIKitCore 0x00000001506bded9 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 246
30 UIKitCore 0x00000001506bf092 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 252
31 UIKitCore 0x00000001516a962d -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 587
32 UIKitCore 0x0000000150f773fb -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 353
33 FrontBoardServices 0x000000012f47b261 __95-[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]_block_invoke + 301
34 FrontBoardServices 0x000000012f47b805 -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:] + 44
35 FrontBoardServices 0x000000012f47b0c7 -[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:] + 561
36 FrontBoardServices 0x000000012f4b3802 __93-[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]_block_invoke.342 + 269
37 FrontBoardServices 0x000000012f48b27b -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 213
38 FrontBoardServices 0x000000012f4b1792 -[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:] + 540
39 libdispatch.dylib 0x0000000123012563 _dispatch_client_callout + 8
40 libdispatch.dylib 0x000000012301602f _dispatch_block_invoke_direct + 475
41 FrontBoardServices 0x000000012f4ded8c FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30
42 FrontBoardServices 0x000000012f4dec66 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 188
43 FrontBoardServices 0x000000012f4dedb4 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 19
44 CoreFoundation 0x0000000110708e54 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
45 CoreFoundation 0x0000000110708d96 __CFRunLoopDoSource0 + 157
46 CoreFoundation 0x00000001107085f5 __CFRunLoopDoSources0 + 293
47 CoreFoundation 0x0000000110702ad2 __CFRunLoopRun + 960
48 CoreFoundation 0x00000001107022d1 CFRunLoopRunSpecific + 550
49 GraphicsServices 0x000000012f95c0cb GSEventRunModal + 137
50 UIKitCore 0x00000001516a7490 -[UIApplication _run] + 875
51 UIKitCore 0x00000001516ac3d1 UIApplicationMain + 123
52 libxamarin-dotnet-debug.dylib 0x0000000109f732ba xamarin_UIApplicationMain + 58
53 libmonosgen-2.0.dylib 0x000000010b904e7c do_icall + 348
54 libmonosgen-2.0.dylib 0x000000010b903407 do_icall_wrapper + 295
55 libmonosgen-2.0.dylib 0x000000010b8f40eb mono_interp_exec_method + 4299
56 libmonosgen-2.0.dylib 0x000000010b8f17b4 interp_runtime_invoke + 260
57 libmonosgen-2.0.dylib 0x000000010b9d00c7 mono_runtime_invoke_checked + 135
58 libmonosgen-2.0.dylib 0x000000010b9d72d5 mono_runtime_exec_main_checked + 117
59 libmonosgen-2.0.dylib 0x000000010b84d886 mono_jit_exec + 358
60 libxamarin-dotnet-debug.dylib 0x0000000109fb3a5a xamarin_main + 1898
61 Miele.App.Domestic 0x00000001003640d4 main + 52
62 dyld 0x0000000108e3e478 start_sim + 10
63 ??? 0x00000002009dc2cd 0x0 + 8600273613

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