dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

Application setting theme and triggering graphics causing a crash on iPad when backgrounded #25723

Open ksoftllc opened 2 weeks ago

ksoftllc commented 2 weeks ago

Description [UPDATED]

When our MAUI app for iOS is run on iPad, it crashes a few seconds after being backgrounded by pressing home button. Interestingly, this doesn't happen on iPhone.

To recreate the crash, I had to add a TabBar to the AppShell.xaml in the MAUI Hello World project.

The cause appears to be receiving theme change events while in the background. Oddly, I do not need to do any theme changes to cause the crash. @mattleibow identified the crash site in his analysis below.

Steps to Reproduce

Link to public reproduction project repository

https://github.com/ksoftllc/CrashOnBackgroundIos

Version with bug

8.0.91 SR9.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

iOS

Affected platform versions

17.x and 18.1

Did you find any workaround?

No workaround

Relevant log output

Here is the symbolicated crash log:


Incident Identifier: FB9DE7D8-9026-4D4B-8234-FCBBA2AC84EC
CrashReporter Key:   e9d59bb6493e25d8c56a94f508953849f890e4de
Hardware Model:      iPad11,6
Process:             FleetHDMobile [3580]
Path:                /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/FleetHDMobile
Identifier:          com.bluedotsolutions.fleethdmobile
Version:             2.8.5 (1)
Code Type:           ARM-64 (Native)
Role:                Background
Parent Process:      launchd [1]
Coalition:           com.bluedotsolutions.fleethdmobile [611]

Date/Time:           2024-11-06 14:13:57.4335 -0700
Launch Time:         2024-11-06 14:13:36.0131 -0700
OS Version:          iPhone OS 18.1 (22B83)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: FRONTBOARD 2343432205 
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: app<com.bluedotsolutions.fleethdmobile(A4C16282-5512-4F72-B182-B0D373D7B255)>:3580 exhausted real (wall clock) time allowance of 10.00 seconds
ProcessVisibility: Background
ProcessState: Running
WatchdogEvent: scene-update
WatchdogVisibility: Background
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 20.760 (user 20.760, system 0.000), 34% CPU",
"Elapsed application CPU time (seconds): 0.224, 0% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>

Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                         0x19ea4c7cc __exceptionPreprocess + 164
1   libobjc.A.dylib                        0x19bd1f2e4 objc_exception_throw + 87
2   Foundation                             0x19de1ca78 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 271
3   UIKitCore                              0x1a125b55c _UIGraphicsBeginImageContextWithOptions + 567
4   FleetHDMobile                          0x102ba195c interp_to_native_trampoline (in FleetHDMobile) + 156 + 9591132
5   FleetHDMobile                          0x102ea2a30 ves_pinvoke_method (in FleetHDMobile) (interp.c:1718) + 12741168
6   FleetHDMobile                          0x102e9718c mono_interp_exec_method (in FleetHDMobile) (interp.c:4172) + 12693900
7   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
8   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
9   FleetHDMobile                          0x102e0bf08 mono_runtime_try_invoke (in FleetHDMobile) (object.c:2733) + 12123912
10  FleetHDMobile                          0x102e0ed40 mono_runtime_invoke (in FleetHDMobile) (object.c:2659) + 12135744
11  FleetHDMobile                          0x102ed1d98 native_to_managed_trampoline_2(objc_object*, objc_selector*, _MonoMethod**, objc_object*, unsigned int) (in FleetHDMobile) (registrar.mm:106) + 12934552
12  FleetHDMobile                          0x102f024b0 -[Microsoft_Maui_Controls_Platform_Compatibility_ShellSectionRootRenderer traitCollectionDidChange:] (in FleetHDMobile) (registrar.mm:21723) + 13132976
13  UIKitCore                              0x1a122044c -[UIViewController _traitCollectionDidChange:] + 1103
14  UIKitCore                              0x1a1295da0 -[UIViewController _updateTraitsIfNecessarySchedulingPropagation:] + 275
15  UIKitCore                              0x1a12349f8 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 687
16  UIKitCore                              0x1a1234afc -[UIView _wrappedProcessTraitChanges:withBehavior:] + 947
17  UIKitCore                              0x1a1234afc -[UIView _wrappedProcessTraitChanges:withBehavior:] + 947
18  UIKitCore                              0x1a1234ba0 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1111
19  UIKitCore                              0x1a1234ba0 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1111
20  UIKitCore                              0x1a1234afc -[UIView _wrappedProcessTraitChanges:withBehavior:] + 947
21  UIKitCore                              0x1a1234ba0 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1111
22  UIKitCore                              0x1a1234ba0 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1111
23  UIKitCore                              0x1a1234ba0 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1111
24  UIKitCore                              0x1a1234ba0 -[UIView _wrappedProcessTraitChanges:withBehavior:] + 1111
25  UIKitCore                              0x1a1234afc -[UIView _wrappedProcessTraitChanges:withBehavior:] + 947
26  UIKitCore                              0x1a1234720 -[UIView _processChangesFromOldTraits:toCurrentTraits:withBehavior:] + 195
27  UIKitCore                              0x1a1234618 -[UIView _updateTraitCollectionAndProcessChangesWithBehavior:previousCollection:] + 111
28  UIKitCore                              0x1a11bd0c0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 943
29  QuartzCore                             0x1a04f3c28 CA::Layer::layout_if_needed(CA::Transaction*) + 495
30  UIKitCore                              0x1a1200138 -[UIView(Hierarchy) layoutBelowIfNeeded] + 311
31  UIKitCore                              0x1a1ccc3ac __UIVIEWCONTROLLERTRANSITIONCOORDINATOR_IS_EXECUTING_ALONGSIDE_ANIMATION_BLOCK__ + 35
32  UIKitCore                              0x1a1493648 -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 123
33  UIKitCore                              0x1a1493518 -[_UIViewControllerTransitionContext __runAlongsideAnimations] + 271
34  UIKitCore                              0x1a1ce1310 -[_UIWindowAnimationController animateTransition:] + 287
35  UIKitCore                              0x1a16c9a50 -[UIWindow _adjustSizeClassesAndResizeWindowToFrame:] + 615
36  UIKitCore                              0x1a1326e40 -[UIWindow _resizeWindowFrameToSceneBoundsIfNecessary] + 203
37  UIKitCore                              0x1a1326308 -[UIWindow _sceneBoundsDidChange] + 67
38  UIKitCore                              0x1a1510cec -[_UIScenefbsSceneBasedMetricsCalculator _updateMetricsOnWindows:animated:] + 959
39  UIKitCore                              0x1a1510904 -[UIWindowScene _computeMetricsForWindows:animated:] + 87
40  UIKitCore                              0x1a138734c __55-[UIWindowScene _computeMetrics:withTransitionContext:]_block_invoke + 103
41  UIKitCore                              0x1a15bc378 -[UIWindowScene _computeTraitCollectionAndCoordinateSpaceForcingDelegateCallback:withAction:] + 295
42  UIKitCore                              0x1a15bccd0 -[UIWindowScene _computeMetrics:withTransitionContext:] + 103
43  UIKitCore                              0x1a19db1e0 ___UIWindowHostingScenePerformUpdateWithEffectiveSettings_block_invoke_2 + 95
44  UIKitCore                              0x1a153c0ac +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] + 139
45  UIKitCore                              0x1a19db160 ___UIWindowHostingScenePerformUpdateWithEffectiveSettings_block_invoke + 135
46  UIKitCore                              0x1a122ff30 +[UIView(Animation) performWithoutAnimation:] + 75
47  UIKitCore                              0x1a19da20c _UIWindowHostingScenePerformUpdateWithEffectiveSettings + 147
48  UIKitCore                              0x1a19da0fc -[UIScene _guardedSetOverrideSettings:] + 123
49  UIKitCore                              0x1a19da340 -[UIScene _applyOverrideSettings:forActions:] + 63
50  UIKitCore                              0x1a2503c64 -[UIWindowScene _applySnapshotSettings:forActions:] + 43
51  UIKitCore                              0x1a22f3414 -[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:] + 319
52  UIKitCore                              0x1a22f4610 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke_3 + 95
53  FrontBoardServices                     0x1b8047088 -[FBSSceneSnapshotAction _executeNextRequest] + 191
54  FrontBoardServices                     0x1b80470a4 -[FBSSceneSnapshotAction _executeNextRequest] + 219
55  FrontBoardServices                     0x1b80470a4 -[FBSSceneSnapshotAction _executeNextRequest] + 219
56  FrontBoardServices                     0x1b8046b1c -[FBSSceneSnapshotAction executeRequestsWithHandler:completionHandler:expirationHandler:] + 255
57  UIKitCore                              0x1a22f4560 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke_2 + 291
58  UIKitCore                              0x1a22f3e00 -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:] + 859
59  UIKitCore                              0x1a22f4410 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke + 155
60  UIKitCore                              0x1a19da278 -[UIScene _enableOverrideSettingsForActions:] + 63
61  UIKitCore                              0x1a19da490 -[UIScene _performSystemSnapshotWithActions:] + 87
62  UIKitCore                              0x1a22f428c -[UIApplication _performSnapshotsWithAction:forScene:completion:] + 251
63  UIKitCore                              0x1a27b7954 __98-[_UISceneSnapshotBSActionsHandler _respondToActions:forFBSScene:inUIScene:fromTransitionContext:]_block_invoke_3 + 179
64  UIKitCore                              0x1a27b77d0 __98-[_UISceneSnapshotBSActionsHandler _respondToActions:forFBSScene:inUIScene:fromTransitionContext:]_block_invoke_2 + 459
65  UIKitCore                              0x1a13c6190 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 579
66  UIKitCore                              0x1a1485824 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 243
67  UIKitCore                              0x1a1485404 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 335
68  FrontBoardServices                     0x1b800c1bc __76-[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.193 + 243
69  FrontBoardServices                     0x1b800bd6c -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:] + 67
70  FrontBoardServices                     0x1b7fdb3c8 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 795
71  FrontBoardServices                     0x1b7fe9db8 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 147
72  FrontBoardServices                     0x1b7fe9c44 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 167
73  FrontBoardServices                     0x1b7fee114 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 339
74  libdispatch.dylib                      0x1a67220d0 _dispatch_client_callout + 19
75  libdispatch.dylib                      0x1a6725b14 _dispatch_block_invoke_direct + 283
76  FrontBoardServices                     0x1b7feb300 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 51
77  FrontBoardServices                     0x1b7feb280 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 239
78  FrontBoardServices                     0x1b7feb158 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 27
79  CoreFoundation                         0x19ea20328 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 27
80  CoreFoundation                         0x19ea202bc __CFRunLoopDoSource0 + 175
81  CoreFoundation                         0x19ea1ddc0 __CFRunLoopDoSources0 + 243
82  CoreFoundation                         0x19ea1cfbc __CFRunLoopRun + 839
83  CoreFoundation                         0x19ea1c830 CFRunLoopRunSpecific + 587
84  GraphicsServices                       0x1ea9fc1c4 GSEventRunModal + 163
85  UIKitCore                              0x1a1582eb0 -[UIApplication _run] + 815
86  UIKitCore                              0x1a16315b4 UIApplicationMain + 339
87  FleetHDMobile                          0x102bb81f4 xamarin_UIApplicationMain + 60
88  FleetHDMobile                          0x102ea3da4 do_icall (in FleetHDMobile) (interp.c:2310) + 12746148
89  FleetHDMobile                          0x102ea26a4 do_icall_wrapper (in FleetHDMobile) (interp.c:2351) + 12740260
90  FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
91  FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
92  FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
93  FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
94  FleetHDMobile                          0x102e112f0 mono_runtime_exec_main_checked (in FleetHDMobile) (object.c:4775) + 12145392
95  FleetHDMobile                          0x102e68ed0 mono_jit_exec (in FleetHDMobile) (driver.c:1314) + 12504784
96  FleetHDMobile                          0x102bcf2f0 xamarin_main (in FleetHDMobile) (monotouch-main.m:495) + 9777904
97  FleetHDMobile                          0x102ed166c main (in FleetHDMobile) (main.arm64.mm:86) + 12932716
98  dyld                                   0x1c440aec8 start + 2723

Thread 0 name:  tid_103
Thread 0 Crashed:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d80 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:32) + 11373952
2   FleetHDMobile                          0x102e24504 mono_w32handle_timedwait_signal_handle (in FleetHDMobile) (w32handle.c:629) + 12223748
3   FleetHDMobile                          0x102e243a8 mono_w32handle_wait_one (in FleetHDMobile) (w32handle.c:741) + 12223400
4   FleetHDMobile                          0x102e44f78 ves_icall_System_Threading_Monitor_Monitor_wait (in FleetHDMobile) (monitor.c:1427) + 12357496
5   FleetHDMobile                          0x102ddeeec ves_icall_System_Threading_Monitor_Monitor_wait_raw (in FleetHDMobile) (icall-def.h:595) + 11939564
6   FleetHDMobile                          0x102ea3d44 do_icall (in FleetHDMobile) (interp.c:2286) + 12746052
7   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
8   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
9   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
10  FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
11  FleetHDMobile                          0x102e0bf08 mono_runtime_try_invoke (in FleetHDMobile) (object.c:2733) + 12123912
12  FleetHDMobile                          0x102e11854 mono_unhandled_exception_checked (in FleetHDMobile) (object.c:4584) + 12146772
13  FleetHDMobile                          0x102e11460 mono_unhandled_exception_internal (in FleetHDMobile) (object.c:4410) + 12145760
14  FleetHDMobile                          0x102e68ef0 mono_jit_exec (in FleetHDMobile) (driver.c:1314) + 12504816
15  FleetHDMobile                          0x102bcf2f0 xamarin_main (in FleetHDMobile) (monotouch-main.m:495) + 9777904
16  FleetHDMobile                          0x102ed166c main (in FleetHDMobile) (main.arm64.mm:86) + 12932716
17  dyld                                   0x1c440aec8 start + 2723

Thread 1:
0   libsystem_pthread.dylib                0x226e44480 start_wqthread + 0

Thread 2 name:  SGen worker
Thread 2:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102da33f8 thread_func (in FleetHDMobile) (sgen-thread-pool.c:195) + 11695096
2   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
3   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 3 name:  Finalizer
Thread 3:
0   libsystem_kernel.dylib                 0x1eedde604 semaphore_wait_trap + 8
1   FleetHDMobile                          0x102e20288 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206728
2   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
3   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 4 name:  .NET TP Worker
Thread 4:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d58 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:75) + 11373912
2   FleetHDMobile                          0x102d58e78 mono_lifo_semaphore_timed_wait (in FleetHDMobile) (lifo-semaphore.c:56) + 11390584
3   FleetHDMobile                          0x102ea3d18 do_icall (in FleetHDMobile) (interp.c:2274) + 12746008
4   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
5   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
6   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
7   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
8   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
9   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 5 name:  .NET TP Gate
Thread 5:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102ea3ce4 do_icall (in FleetHDMobile) (interp.c:2329) + 12745956
2   FleetHDMobile                          0x102ea26a4 do_icall_wrapper (in FleetHDMobile) (interp.c:2351) + 12740260
3   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
4   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
5   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
6   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
7   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
8   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
9   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 6 name:  .NET TP Worker
Thread 6:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d58 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:75) + 11373912
2   FleetHDMobile                          0x102d58e78 mono_lifo_semaphore_timed_wait (in FleetHDMobile) (lifo-semaphore.c:56) + 11390584
3   FleetHDMobile                          0x102ea3d18 do_icall (in FleetHDMobile) (interp.c:2274) + 12746008
4   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
5   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
6   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
7   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
8   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
9   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 7 name:  tid_3f03
Thread 7:
0   libsystem_pthread.dylib                0x226e44480 start_wqthread + 0

Thread 8:
0   libsystem_pthread.dylib                0x226e44480 start_wqthread + 0

Thread 9 name:  tid_3803
Thread 9:
0   libsystem_pthread.dylib                0x226e44480 start_wqthread + 0

Thread 10 name:  com.apple.uikit.eventfetch-thread
Thread 10:
0   libsystem_kernel.dylib                 0x1eedde688 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1eede1cb0 mach_msg_overwrite + 423
2   libsystem_kernel.dylib                 0x1eede1afc mach_msg + 23
3   CoreFoundation                         0x19ea1da84 __CFRunLoopServiceMachPort + 159
4   CoreFoundation                         0x19ea1d130 __CFRunLoopRun + 1211
5   CoreFoundation                         0x19ea1c830 CFRunLoopRunSpecific + 587
6   Foundation                             0x19d6c4500 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 211
7   Foundation                             0x19d6c4350 -[NSRunLoop(NSRunLoop) runUntilDate:] + 63
8   UIKitCore                              0x1a1596358 -[UIEventFetcher threadMain] + 419
9   Foundation                             0x19d6d56c8 __NSThread__start__ + 723
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 11:
0   libsystem_kernel.dylib                 0x1eede41b0 __semwait_signal + 8
1   libsystem_c.dylib                      0x1a67d9550 sleep + 51
2   Sentry                                 0x103897bb0 monitorCachedData + 676
3   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
4   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 12 name:  SentryCrash Exception Handler (Secondary)
Thread 12:
0   libsystem_kernel.dylib                 0x1eedde688 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1eeddfbfc thread_suspend + 107
2   Sentry                                 0x103880098 handleExceptions + 128
3   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
4   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 13 name:  SentryCrash Exception Handler (Primary)
Thread 13:
0   libsystem_kernel.dylib                 0x1eedde688 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1eede1cb0 mach_msg_overwrite + 423
2   libsystem_kernel.dylib                 0x1eede1afc mach_msg + 23
3   Sentry                                 0x1038800c4 handleExceptions + 172
4   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
5   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 14 name:  io.sentry.app-hang-tracker
Thread 14:
0   libsystem_kernel.dylib                 0x1eede41b0 __semwait_signal + 8
1   Foundation                             0x19d7dbaf8 +[NSThread sleepForTimeInterval:] + 159
2   Sentry                                 0x10386338c -[SentryANRTracker detectANRs] + 560
3   Foundation                             0x19d6d56c8 __NSThread__start__ + 723
4   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
5   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 15 name:  .NET TP Worker
Thread 15:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d58 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:75) + 11373912
2   FleetHDMobile                          0x102d58e78 mono_lifo_semaphore_timed_wait (in FleetHDMobile) (lifo-semaphore.c:56) + 11390584
3   FleetHDMobile                          0x102ea3d18 do_icall (in FleetHDMobile) (interp.c:2274) + 12746008
4   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
5   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
6   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
7   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
8   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
9   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 16 name:  .NET Timer
Thread 16:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102ea3ce4 do_icall (in FleetHDMobile) (interp.c:2329) + 12745956
2   FleetHDMobile                          0x102ea26a4 do_icall_wrapper (in FleetHDMobile) (interp.c:2351) + 12740260
3   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
4   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
5   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
6   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
7   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
8   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
9   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 17:
0   libsystem_pthread.dylib                0x226e44480 start_wqthread + 0

Thread 18 name:  tid_9e03
Thread 18:
0   libsystem_pthread.dylib                0x226e44480 start_wqthread + 0

Thread 19 name:  .NET TP Worker
Thread 19:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d58 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:75) + 11373912
2   FleetHDMobile                          0x102d58e78 mono_lifo_semaphore_timed_wait (in FleetHDMobile) (lifo-semaphore.c:56) + 11390584
3   FleetHDMobile                          0x102ea3d18 do_icall (in FleetHDMobile) (interp.c:2274) + 12746008
4   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
5   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
6   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
7   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
8   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
9   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 20 name:  .NET TP Worker
Thread 20:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d58 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:75) + 11373912
2   FleetHDMobile                          0x102d58e78 mono_lifo_semaphore_timed_wait (in FleetHDMobile) (lifo-semaphore.c:56) + 11390584
3   FleetHDMobile                          0x102ea3d18 do_icall (in FleetHDMobile) (interp.c:2274) + 12746008
4   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
5   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
6   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
7   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
8   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
9   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 21 name:  .NET TP Worker
Thread 21:
0   libsystem_kernel.dylib                 0x1eede3f90 __psynch_cvwait + 8
1   FleetHDMobile                          0x102d54d58 mono_os_cond_timedwait (in FleetHDMobile) (mono-os-mutex.c:75) + 11373912
2   FleetHDMobile                          0x102d58e78 mono_lifo_semaphore_timed_wait (in FleetHDMobile) (lifo-semaphore.c:56) + 11390584
3   FleetHDMobile                          0x102ea3d18 do_icall (in FleetHDMobile) (interp.c:2274) + 12746008
4   FleetHDMobile                          0x102ea26dc do_icall_wrapper (in FleetHDMobile) (interp.c:2357) + 12740316
5   FleetHDMobile                          0x102e970b4 mono_interp_exec_method (in FleetHDMobile) (interp.c:0) + 12693684
6   FleetHDMobile                          0x102e94c4c interp_runtime_invoke (in FleetHDMobile) (interp.c:2110) + 12684364
7   FleetHDMobile                          0x102e638b4 mono_jit_runtime_invoke (in FleetHDMobile) (mini-runtime.c:3673) + 12482740
8   FleetHDMobile                          0x102e0aff4 mono_runtime_invoke_checked (in FleetHDMobile) (object.c:2792) + 12120052
9   FleetHDMobile                          0x102e20380 start_wrapper (in FleetHDMobile) (threads.c:1271) + 12206976
10  libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
11  libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 22 name:  com.apple.NSURLConnectionLoader
Thread 22:
0   libsystem_kernel.dylib                 0x1eedde688 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1eede1cb0 mach_msg_overwrite + 423
2   libsystem_kernel.dylib                 0x1eede1afc mach_msg + 23
3   CoreFoundation                         0x19ea1da84 __CFRunLoopServiceMachPort + 159
4   CoreFoundation                         0x19ea1d130 __CFRunLoopRun + 1211
5   CoreFoundation                         0x19ea1c830 CFRunLoopRunSpecific + 587
6   CFNetwork                              0x19ff98ee0 +[__CFN_CoreSchedulingSetRunnable _run:] + 415
7   Foundation                             0x19d6d56c8 __NSThread__start__ + 723
8   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
9   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 23 name:  com.apple.CoreMotion.MotionThread
Thread 23:
0   libsystem_kernel.dylib                 0x1eedde688 mach_msg2_trap + 8
1   libsystem_kernel.dylib                 0x1eede1cb0 mach_msg_overwrite + 423
2   libsystem_kernel.dylib                 0x1eede1afc mach_msg + 23
3   CoreFoundation                         0x19ea1da84 __CFRunLoopServiceMachPort + 159
4   CoreFoundation                         0x19ea1d130 __CFRunLoopRun + 1211
5   CoreFoundation                         0x19ea1c830 CFRunLoopRunSpecific + 587
6   CoreFoundation                         0x19ea87cec CFRunLoopRun + 63
7   CoreMotion                             0x1abeac084 0x1abeabb79 + 1291
8   libsystem_pthread.dylib                0x226e4937c _pthread_start + 135
9   libsystem_pthread.dylib                0x226e44494 thread_start + 7

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000104   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000000   x5: 0x00000000000000a1   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x000000016db820b8   x9: 0x0000000000000000  x10: 0x0000000000000000  x11: 0x0000000000000002
   x12: 0x0000000000000002  x13: 0x0000000000000000  x14: 0x0000000000000000  x15: 0x0000000000000000
   x16: 0x0000000000000131  x17: 0x00000000000001e8  x18: 0x0000000000000000  x19: 0x00000001044dc238
   x20: 0x00000001044dc278  x21: 0x00000002027ba4e0  x22: 0x0000000000000000  x23: 0x0000000000000000
   x24: 0x0000000000000000  x25: 0x0000000000000001  x26: 0x0000000000000100  x27: 0x0000000000000001
   x28: 0x0000000000000000   fp: 0x000000016db82130   lr: 0x0000000226e46a50
    sp: 0x000000016db820a0   pc: 0x00000001eede3f90 cpsr: 0x60000000
   far: 0x0000000000000000  esr: 0x56000080  Address size fault

Binary Images:
       0x10227c000 -        0x10301ffff FleetHDMobile arm64  <5cf8cd3f7ad736d6b54d2070b336b473> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/FleetHDMobile
       0x10317c000 -        0x1031cbfff FirebaseAuth arm64  <d3d1c32a76943e629e21299a8ae01f89> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/FirebaseAuth.framework/FirebaseAuth
       0x10332c000 -        0x10335ffff FirebaseMessaging arm64  <a19db0ac1df738088ddca65fa23bda04> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/FirebaseMessaging.framework/FirebaseMessaging
       0x1033b8000 -        0x1033c7fff FirebaseCore arm64  <3f50ffa42e2c3f10bad34d29de3a608e> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/FirebaseCore.framework/FirebaseCore
       0x103284000 -        0x10328bfff FirebaseCoreDiagnostics arm64  <9d982b363ab230ddb9e32a6004e26e9c> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics
       0x1033ec000 -        0x103417fff GTMSessionFetcher arm64  <84d0325992313d748fa8fee8d60fb6fb> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/GTMSessionFetcher.framework/GTMSessionFetcher
       0x103464000 -        0x103493fff GoogleAPIClientForREST arm64  <1f89d70b7f623350957ac8eeaa5e90ef> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/GoogleAPIClientForREST.framework/GoogleAPIClientForREST
       0x103568000 -        0x103587fff GoogleDataTransport arm64  <55d86e7837703932ac2cc9db93e53a7d> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/GoogleDataTransport.framework/GoogleDataTransport
       0x1035c4000 -        0x1035d3fff FBLPromises arm64  <fb242e46c19339878439ebba20a8f2db> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/FBLPromises.framework/FBLPromises
       0x1035f4000 -        0x1035fffff GoogleToolboxForMac arm64  <9ebfff25122e37389e770c30e0c99b16> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac
       0x103618000 -        0x103633fff GoogleUtilities arm64  <ceeb119d01e4353a9a142f9599f8f6ff> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/GoogleUtilities.framework/GoogleUtilities
       0x103668000 -        0x10366ffff nanopb arm64  <209b8d5a160e3d7395c9ec3eccbe1235> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/nanopb.framework/nanopb
       0x10367c000 -        0x1036affff leveldb arm64  <705804dddf153aaf9342d696af03bf2f> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/leveldb.framework/leveldb
       0x103708000 -        0x10374ffff Protobuf arm64  <9447cd88c361327788f90d8681b27997> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/Protobuf.framework/Protobuf
       0x1037f8000 -        0x10380ffff FirebaseInstallations arm64  <9243fd05262f37e1b589135955eb9569> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/FirebaseInstallations.framework/FirebaseInstallations
       0x103840000 -        0x10393bfff Sentry arm64  <c707d8ab41b93487afa3549a1dddc663> /private/var/containers/Bundle/Application/7D11F3E7-DA69-4FC9-BF83-49752660DA4D/FleetHDMobile.app/Frameworks/Sentry.framework/Sentry
       0x1081b4000 -        0x1081bffff libobjc-trampolines.dylib arm64e  <35a44678195b39c2bdd7072893564b45> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
       0x1eeddd000 -        0x1eee16ff3 libsystem_kernel.dylib arm64e  <b9618c71c0cb31b6825f92a4737c890e> /usr/lib/system/libsystem_kernel.dylib
       0x1c43d7000 -        0x1c445a99f dyld arm64e  <3060d36a16ce3c3a92583881459f5714> /usr/lib/dyld
               0x0 - 0xffffffffffffffff ??? unknown-arch  <00000000000000000000000000000000> ???
       0x226e43000 -        0x226e4fff3 libsystem_pthread.dylib arm64e  <3ca98e388eee3c269862c5f66aad93c0> /usr/lib/system/libsystem_pthread.dylib
       0x1a6764000 -        0x1a67e3ff3 libsystem_c.dylib arm64e  <0150f750db0a3f54b23ad21c55af8824> /usr/lib/system/libsystem_c.dylib
       0x19e9ca000 -        0x19ef0cfff CoreFoundation arm64e  <1532d3d89b3b3f2fb35f55a20ddf411b> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
       0x19d60d000 -        0x19e31afff Foundation arm64e  <6d0212cc3b9e32c9be2072989ce3acb8> /System/Library/Frameworks/Foundation.framework/Foundation
       0x1a11b0000 -        0x1a3083fff UIKitCore arm64e  <575e5140fa6a37c2b00ba4eacedfda53> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
       0x19fe9b000 -        0x1a025dfff CFNetwork arm64e  <999c659afc7d351fa477e97bbf2d8081> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
       0x1abe9c000 -        0x1ac2a0fff CoreMotion arm64e  <ad76b51c2c19371888c6e6a9d73d5868> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
       0x19bd08000 -        0x19bd58d5f libobjc.A.dylib arm64e  <1608892e67db3f949fc291492b86c95f> /usr/lib/libobjc.A.dylib
       0x1a047b000 -        0x1a0820fff QuartzCore arm64e  <d8e8e86d85ac3c90b2e1940235ecaa18> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
       0x1b7fd5000 -        0x1b80a7fff FrontBoardServices arm64e  <d627737b3c6c3308a90cad705542c2b3> /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices
       0x1a671e000 -        0x1a6763fff libdispatch.dylib arm64e  <7de7ec03cfb7349d9b9e8782b38f231d> /usr/lib/system/libdispatch.dylib
       0x1ea9fb000 -        0x1eaa03fff GraphicsServices arm64e  <8425ea11000e3e5e8abcbddf3ff3fa32> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices

I don't see anything here from our source code, but would love some help interpreting this.

ksoftllc commented 2 weeks ago

Also, this crash does not get reported by Sentry.io like other uncaught exceptions.

drasticactions commented 2 weeks ago

Does this replicate with something that isn't your application (Ex. a new Template app?) or does it only happen when run in your app?

ksoftllc commented 2 weeks ago

I have not been able to create a simple app to reproduce the crash. But it happens 100% of the time on iPad.

I did add a catch in Program.cs

public class Program
{
    // This is the main entry point of the application.
    static void Main(string[] args)
    {
        // if you want to use a different Application Delegate class from "AppDelegate"
        // you can specify it here.
        try
        {
            UIApplication.Main(args, null, typeof(AppDelegate));
        }
        catch (System.Exception ex)
        {
            var logger = MauiProgram.ServiceProvider.GetService<ILogger>();
            logger.LogError(true, ex, $"Uncaught exception {ex.Message}");
        }
    }
}

Here is the logged exception:

Uncaught exception Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 810}, scale=2.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.
Native stack trace:
    0   CoreFoundation                      0x000000019ea4c7d8 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 534488
    1   libobjc.A.dylib                     0x000000019bd1f2e4 objc_exception_throw + 88
    2   Foundation                          0x000000019de1ca78 6D0212CC-3B9E-32C9-BE20-72989CE3ACB8 + 8452728
    3   UIKitCore                           0x00000001a125b55c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 701788
    4   FleetHDMobile                       0x0000000102c6195c FleetHDMobile + 9591132
    5   FleetHDMobile                       0x0000000102f62a30 AppleCryptoNative_X509ImportCertificate + 2881592
    6   FleetHDMobile                       0x0000000102f5718c AppleCryptoNative_X509ImportCertificate + 2834324
    7   FleetHDMobile                       0x0000000102f54c4c AppleCryptoNative_X509ImportCertificate + 2824788
    8   FleetHDMobile                       0x0000000102f238b4 AppleCryptoNative_X509ImportCertificate + 2623164
    9   FleetHDMobile                       0x0000000102ecbf08 AppleCryptoNative_X509ImportCertificate + 2264336
    10  FleetHDMobile                       0x0000000102eced40 AppleCryptoNative_X509ImportCertificate + 2276168
    11  FleetHDMobile                       0x0000000102f91d98 AppleCryptoNative_X509ImportCertificate + 3074976
    12  FleetHDMobile                       0x0000000102fc24b0 AppleCryptoNative_X509ImportCertificate + 3273400
    13  UIKitCore                           0x00000001a122044c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 459852
    14  UIKitCore                           0x00000001a1295da0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 941472
    15  UIKitCore                           0x00000001a12349f8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543224
    16  UIKitCore                           0x00000001a1234afc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    17  UIKitCore                           0x00000001a1234afc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    18  UIKitCore                           0x00000001a1234ba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    19  UIKitCore                           0x00000001a1234ba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    20  UIKitCore                           0x00000001a1234afc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    21  UIKitCore                           0x00000001a1234ba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    22  UIKitCore                           0x00000001a1234ba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    23  UIKitCore                           0x00000001a1234ba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    24  UIKitCore                           0x00000001a1234ba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    25  UIKitCore                           0x00000001a1234afc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    26  UIKitCore                           0x00000001a1234720 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 542496
    27  UIKitCore                           0x00000001a1234618 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 542232
    28  UIKitCore                           0x00000001a11bd0c0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 53440
    29  QuartzCore                          0x00000001a04f3c28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
    30  UIKitCore                           0x00000001a1200138 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 327992
    31  UIKitCore                           0x00000001a1ccc3ac __UIVIEWCONTROLLERTRANSITIONCOORDINATOR_IS_EXECUTING_ALONGSIDE_ANIMATION_BLOCK__ + 36
    32  UIKitCore                           0x00000001a1493648 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3028552
    33  UIKitCore                           0x00000001a1493518 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3028248
    34  UIKitCore                           0x00000001a1ce1310 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11735824
    35  UIKitCore                           0x00000001a16c9a50 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 5347920
    36  UIKitCore                           0x00000001a1326e40 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1535552
    37  UIKitCore                           0x00000001a1326308 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1532680
    38  UIKitCore                           0x00000001a1510cec 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3542252
    39  UIKitCore                           0x00000001a1510904 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3541252
    40  UIKitCore                           0x00000001a138734c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1930060
    41  UIKitCore                           0x00000001a15bc378 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4244344
    42  UIKitCore                           0x00000001a15bccd0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4246736
    43  UIKitCore                           0x00000001a19db1e0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8565216
    44  UIKitCore                           0x00000001a153c0ac 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3719340
    45  UIKitCore                           0x00000001a19db160 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8565088
    46  UIKitCore                           0x00000001a122ff30 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 524080
    47  UIKitCore                           0x00000001a19da20c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561164
    48  UIKitCore                           0x00000001a19da0fc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8560892
    49  UIKitCore                           0x00000001a19da340 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561472
    50  UIKitCore                           0x00000001a2503c64 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 20266084
    51  UIKitCore                           0x00000001a22f3414 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18101268
    52  UIKitCore                           0x00000001a22f4610 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18105872
    53  FrontBoardServices                  0x00000001b8047088 D627737B-3C6C-3308-A90C-AD705542C2B3 + 467080
    54  FrontBoardServices                  0x00000001b80470a4 D627737B-3C6C-3308-A90C-AD705542C2B3 + 467108
    55  FrontBoardServices                  0x00000001b80470a4 D627737B-3C6C-3308-A90C-AD705542C2B3 + 467108
    56  FrontBoardServices                  0x00000001b8046b1c D627737B-3C6C-3308-A90C-AD705542C2B3 + 465692
    57  UIKitCore                           0x00000001a22f4560 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18105696
    58  UIKitCore                           0x00000001a22f3e00 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18103808
    59  UIKitCore                           0x00000001a22f4410 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18105360
    60  UIKitCore                           0x00000001a19da278 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561272
    61  UIKitCore                           0x00000001a19da490 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561808
    62  UIKitCore                           0x00000001a22f428c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18104972
    63  UIKitCore                           0x00000001a27b7954 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 23099732
    64  UIKitCore                           0x00000001a27b77d0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 23099344
    65  UIKitCore                           0x00000001a13c6190 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2187664
    66  UIKitCore                           0x00000001a1485824 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2971684
    67  UIKitCore                           0x00000001a1485404 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2970628
    68  FrontBoardServices                  0x00000001b800c1bc D627737B-3C6C-3308-A90C-AD705542C2B3 + 225724
    69  FrontBoardServices                  0x00000001b800bd6c D627737B-3C6C-3308-A90C-AD705542C2B3 + 224620
    70  FrontBoardServices                  0x00000001b7fdb3c8 D627737B-3C6C-3308-A90C-AD705542C2B3 + 25544
    71  FrontBoardServices                  0x00000001b7fe9db8 D627737B-3C6C-3308-A90C-AD705542C2B3 + 85432
    72  FrontBoardServices                  0x00000001b7fe9c44 D627737B-3C6C-3308-A90C-AD705542C2B3 + 85060
    73  FrontBoardServices                  0x00000001b7fee114 D627737B-3C6C-3308-A90C-AD705542C2B3 + 102676
    74  libdispatch.dylib                   0x00000001a67220d0 7DE7EC03-CFB7-349D-9B9E-8782B38F231D + 16592
    75  libdispatch.dylib                   0x00000001a6725b14 7DE7EC03-CFB7-349D-9B9E-8782B38F231D + 31508
    76  FrontBoardServices                  0x00000001b7feb300 D627737B-3C6C-3308-A90C-AD705542C2B3 + 90880
    77  FrontBoardServices                  0x00000001b7feb280 D627737B-3C6C-3308-A90C-AD705542C2B3 + 90752
    78  FrontBoardServices                  0x00000001b7feb158 D627737B-3C6C-3308-A90C-AD705542C2B3 + 90456
    79  CoreFoundation                      0x000000019ea20328 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 353064
    80  CoreFoundation                      0x000000019ea202bc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 352956
    81  CoreFoundation                      0x000000019ea1ddc0 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 343488
    82  CoreFoundation                      0x000000019ea1cfbc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 339900
    83  CoreFoundation                      0x000000019ea1c830 CFRunLoopRunSpecific + 588
    84  GraphicsServices                    0x00000001ea9fc1c4 GSEventRunModal + 164
    85  UIKitCore                           0x00000001a1582eb0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4009648
    86  UIKitCore                           0x00000001a16315b4 UIApplicationMain + 340
    87  FleetHDMobile                       0x0000000102c781f4 xamarin_UIApplicationMain + 60
    88  FleetHDMobile                       0x0000000102f63da4 AppleCryptoNative_X509ImportCertificate + 2886572
    89  FleetHDMobile                       0x0000000102f626a4 AppleCryptoNative_X509ImportCertificate + 2880684
    90  FleetHDMobile                       0x0000000102f570b4 AppleCryptoNative_X509ImportCertificate + 2834108
    91  FleetHDMobile                       0x0000000102f54c4c AppleCryptoNative_X509ImportCertificate + 2824788
    92  FleetHDMobile                       0x0000000102f238b4 AppleCryptoNative_X509ImportCertificate + 2623164
    93  FleetHDMobile                       0x0000000102ecaff4 AppleCryptoNative_X509ImportCertificate + 2260476
    94  FleetHDMobile                       0x0000000102ed12f0 AppleCryptoNative_X509ImportCertificate + 2285816
    95  FleetHDMobile                       0x0000000102f28ed0 AppleCryptoNative_X509ImportCertificate + 2645208
    96  FleetHDMobile                       0x0000000102c8f2f0 xamarin_log + 22332
    97  FleetHDMobile                       0x0000000102f9166c AppleCryptoNative_X509ImportCertificate + 3073140
    98  dyld                                0x00000001c440aec8 3060D36A-16CE-3C3A-9258-3881459F5714 + 212680

I cannot figure out what about going into the background would produce this crash.

Also, why does AppleCryptoNative_X509ImportCertificate appears so many times? And why would crypto be interspersed with UIKit calls? Is this happening due to snapshotting by iOS when the app goes to background?

albyrock87 commented 1 week ago

Are you using background services? https://developer.apple.com/documentation/xcode/configuring-background-execution-modes

Like fetch or processing?

From the stack trace it's clear that iOS kills your app because it ran in the background for more than 10 seconds, which is not allowed.

ksoftllc commented 1 week ago

@albyrock87 No, no background services.

using BackgroundTasks;
using CoreFoundation;
using FleetHDMobile.Platforms.iOS;
using FleetHDMobile.Services;
using Foundation;
using Microsoft.Extensions.Logging;
using UIKit;

namespace FleetHDMobile;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
    protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

    public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
            => Platform.PerformActionForShortcutItem(application, shortcutItem, completionHandler);

}
albyrock87 commented 1 week ago

@ksoftllc well, that PerformActionForShortcutItem is kind of a background service.

Are you invoking the completionHandler within a few seconds?

ksoftllc commented 1 week ago

I simplified the AppDelegate to just this, but it still crashes.

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
    protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}

The stack trace shows AppleCryptoNative_X509ImportCertificate activity, which I really don't understand why. When the app is backgrounded or even foregrounded, there is nothing in the code that would explicitly invoke crypto.

albyrock87 commented 1 week ago

Thanks for confirming. I guess that part might be related to the underlying implementation of the HttpClientMessageHandler. Besides that, I don't have anything to add here to further investigate the issue.

ksoftllc commented 1 week ago

More info from additional logging. Here is a stack trace of the crash:

  at ObjCRuntime.Runtime.ThrowNSException(IntPtr ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 564
   at UIKit.UIGraphics.BeginImageContextWithOptions(CGSize , Boolean , NFloat ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIGraphics.cs:line 92
   at Microsoft.Maui.Controls.Platform.BrushExtensions.GetBackgroundImage(UIView control, Brush brush)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutContentRenderer.UpdateBackground()
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutContentRenderer.HandleShellPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.Shell.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.AppThemeBinding.<>c__DisplayClass11_0.<ApplyCore>g__Set|0()
   at Microsoft.Maui.Controls.AppThemeBinding.ApplyCore(Boolean dispatch)
   at Microsoft.Maui.Controls.AppThemeBinding.Apply(Boolean fromTarget)
   at Microsoft.Maui.Controls.AppThemeBinding.AppThemeProxy.OnAppThemeChanged()
   at Microsoft.Maui.Controls.AppThemeBinding.AppThemeProxy.<>c.<.cctor>b__8_0(BindableObject bindable, Object oldValue, Object newValue)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.VisualElement.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Application.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Application.TriggerThemeChangedActual()
   at Microsoft.Maui.Controls.Application.set_PlatformAppTheme(AppTheme value)
   at Microsoft.Maui.Controls.Application.Microsoft.Maui.IApplication.ThemeChanged()
   at Microsoft.Maui.Platform.PageViewController.TraitCollectionDidChange(UITraitCollection previousTraitCollection)
__- End of stack trace from previous location __-
http client called
[2024-11-12 11:39:29,373][ERR][FleetHdMobileApiClient.Setting.cs:37] Exception pulling Driver Agent Setting for tenant ,  uri: ///setting/dasetting
System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
   at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage )
   at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage )
   at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage , HttpCompletionOption , CancellationToken )
   at System.Net.Http.HttpClient.GetAsync(Uri , HttpCompletionOption , CancellationToken )
   at System.Net.Http.HttpClient.GetAsync(Uri , HttpCompletionOption )
   at System.Net.Http.HttpClient.GetAsync(Uri )
   at System.Net.Http.HttpClient.GetAsync(String )
   at FleetHDMobile.Services.FleetHdApi.HttpServiceBase.<GetHttpAsync>d__5`1[[FleetHd.Mobile.Contracts.Setting.DriverAgentSettingDto, FleetHd.Mobile.Contracts, Version=2.18.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Services/FleetHdApi/HttpServiceBase.cs:line 25
   at FleetHDMobile.Services.FleetHdApi.FleetHdMobileApiClient.<GetDriverAgentSetting>b__25_0() in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Services/FleetHdApi/FleetHdMobileApiClient.Setting.cs:line 33
[2024-11-12 11:39:29,574][ERR][DriverAgentSettingService.cs:132] using default setting from device because of this exception
System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
   at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage )
   at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage )
   at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage , HttpCompletionOption , CancellationToken )
   at System.Net.Http.HttpClient.GetAsync(Uri , HttpCompletionOption , CancellationToken )
   at System.Net.Http.HttpClient.GetAsync(Uri , HttpCompletionOption )
   at System.Net.Http.HttpClient.GetAsync(Uri )
   at System.Net.Http.HttpClient.GetAsync(String )
   at FleetHDMobile.Services.FleetHdApi.HttpServiceBase.<GetHttpAsync>d__5`1[[FleetHd.Mobile.Contracts.Setting.DriverAgentSettingDto, FleetHd.Mobile.Contracts, Version=2.18.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Services/FleetHdApi/HttpServiceBase.cs:line 25
   at FleetHDMobile.Services.FleetHdApi.FleetHdMobileApiClient.<GetDriverAgentSetting>b__25_0() in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Services/FleetHdApi/FleetHdMobileApiClient.Setting.cs:line 38
   at FleetHDMobile.Services.FleetHdApi.FleetHdMobileApiClient.GetDriverAgentSetting() in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Services/FleetHdApi/FleetHdMobileApiClient.Setting.cs:line 27
   at FleetHDMobile.Services.DriverAgentSettingService.SaveDefaultSettingsAsync() in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Services/DriverAgentSettingService.cs:line 123
[2024-11-12 11:39:35,137][INF][:] enrolling
[2024-11-12 11:39:35,15][INF][:] decrytping
[2024-11-12 11:39:35,215][INF][:] decrypted
[2024-11-12 11:39:35,228][INF][:] Start processing HTTP request GET https://identity-test.fleethd.com/.well-known/openid-configuration
[2024-11-12 11:39:35,234][INF][:] Sending HTTP request GET https://identity-test.fleethd.com/.well-known/openid-configuration
[2024-11-12 11:39:35,718][INF][:] Received HTTP response headers after 479.8343ms - 200
[2024-11-12 11:39:35,724][INF][:] End processing HTTP request after 499.5539ms - 200
[2024-11-12 11:39:35,74][INF][:] Start processing HTTP request GET https://identity-test.fleethd.com/.well-known/openid-configuration/jwks
[2024-11-12 11:39:35,742][INF][:] Sending HTTP request GET https://identity-test.fleethd.com/.well-known/openid-configuration/jwks
[2024-11-12 11:39:35,891][INF][:] Received HTTP response headers after 145.4607ms - 200
[2024-11-12 11:39:35,897][INF][:] End processing HTTP request after 156.005ms - 200
[2024-11-12 11:39:35,937][INF][:] Start processing HTTP request POST https://identity-test.fleethd.com/connect/token
[2024-11-12 11:39:35,938][INF][:] Sending HTTP request POST https://identity-test.fleethd.com/connect/token
[2024-11-12 11:39:36,18][INF][:] Received HTTP response headers after 236.9353ms - 200
[2024-11-12 11:39:36,19][INF][:] End processing HTTP request after 251.5533ms - 200
[2024-11-12 11:39:36,228][INF][:] http client called
[2024-11-12 11:39:36,232][INF][:] Start processing HTTP request GET https://mobile-api-test.fleethd.com/v1.0/tenant/1/ext-rush_preview
[2024-11-12 11:39:36,233][INF][:] Sending HTTP request GET https://mobile-api-test.fleethd.com/v1.0/tenant/1/ext-rush_preview
[2024-11-12 11:39:36,716][INF][:] Received HTTP response headers after 476.05ms - 200
[2024-11-12 11:39:36,725][INF][:] End processing HTTP request after 491.099ms - 200
[2024-11-12 11:39:36,775][INF][:] http client called
[2024-11-12 11:39:36,782][INF][:] Start processing HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/setting/msasetting
[2024-11-12 11:39:36,783][INF][:] Sending HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/setting/msasetting
[2024-11-12 11:39:36,943][INF][:] Received HTTP response headers after 155.7728ms - 200
[2024-11-12 11:39:36,948][INF][:] End processing HTTP request after 165.8167ms - 200
[2024-11-12 11:39:36,999][INF][:] http client called
[2024-11-12 11:39:37,003][INF][:] Start processing HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/setting/dasetting
[2024-11-12 11:39:37,004][INF][:] Sending HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/setting/dasetting
[2024-11-12 11:39:37,12][INF][:] Received HTTP response headers after 114.5331ms - 200
[2024-11-12 11:39:37,124][INF][:] End processing HTTP request after 121.3646ms - 200
[2024-11-12 11:39:37,17][INF][:] http client called
[2024-11-12 11:39:37,175][INF][:] Start processing HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/setting/versionsetting
[2024-11-12 11:39:37,176][INF][:] Sending HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/setting/versionsetting
[2024-11-12 11:39:37,261][INF][:] Received HTTP response headers after 83.5758ms - 200
[2024-11-12 11:39:37,263][INF][:] End processing HTTP request after 88.7605ms - 200
[2024-11-12 11:39:39,898][INF][:] http client called
[2024-11-12 11:39:39,91][INF][:] Start processing HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/vehiclestate/nearby/identity/-107.93973559481766/38.87430454620713/80.4672
[2024-11-12 11:39:39,912][INF][:] Sending HTTP request GET https://mobile-api-test.fleethd.com/v1.0/ext-rush_preview/vehiclestate/nearby/identity/-107.93973559481766/38.87430454620713/80.4672
[2024-11-12 11:39:40,068][INF][:] Received HTTP response headers after 155.1397ms - 200
[2024-11-12 11:39:40,07][INF][:] End processing HTTP request after 160.1551ms - 200
[2024-11-12 11:40:04,815][INF][AppRoutingService.cs:546] sleeping, so reset open analytics state
[2024-11-12 11:40:05,35][ERR][:] CRASH
ObjCRuntime.ObjCException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 810}, scale=2.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.
Native stack trace:
    0   CoreFoundation                      0x00000001916847d8 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 534488
    1   libobjc.A.dylib                     0x000000018e9572e4 objc_exception_throw + 88
    2   Foundation                          0x0000000190a54a78 6D0212CC-3B9E-32C9-BE20-72989CE3ACB8 + 8452728
    3   UIKitCore                           0x0000000193e9355c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 701788
    4   FleetHDMobile                       0x00000001034c195c FleetHDMobile + 9591132
    5   FleetHDMobile                       0x00000001037c2a30 AppleCryptoNative_X509ImportCertificate + 2881592
    6   FleetHDMobile                       0x00000001037b718c AppleCryptoNative_X509ImportCertificate + 2834324
    7   FleetHDMobile                       0x00000001037b4c4c AppleCryptoNative_X509ImportCertificate + 2824788
    8   FleetHDMobile                       0x00000001037838b4 AppleCryptoNative_X509ImportCertificate + 2623164
    9   FleetHDMobile                       0x000000010372bf08 AppleCryptoNative_X509ImportCertificate + 2264336
    10  FleetHDMobile                       0x000000010372ed40 AppleCryptoNative_X509ImportCertificate + 2276168
    11  FleetHDMobile                       0x00000001037f1d98 AppleCryptoNative_X509ImportCertificate + 3074976
    12  FleetHDMobile                       0x000000010382cfc4 AppleCryptoNative_X509ImportCertificate + 3317196
    13  UIKitCore                           0x0000000193e5844c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 459852
    14  UIKitCore                           0x0000000193ecdda0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 941472
    15  UIKitCore                           0x0000000193e6c9f8 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543224
    16  UIKitCore                           0x0000000193e6cafc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    17  UIKitCore                           0x0000000193e6cafc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    18  UIKitCore                           0x0000000193e6cba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    19  UIKitCore                           0x0000000193e6cba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    20  UIKitCore                           0x0000000193e6cafc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    21  UIKitCore                           0x0000000193e6cba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    22  UIKitCore                           0x0000000193e6cba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    23  UIKitCore                           0x0000000193e6cba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    24  UIKitCore                           0x0000000193e6cba0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543648
    25  UIKitCore                           0x0000000193e6cafc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 543484
    26  UIKitCore                           0x0000000193e6c720 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 542496
    27  UIKitCore                           0x0000000193e6c618 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 542232
    28  UIKitCore                           0x0000000193df50c0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 53440
    29  QuartzCore                          0x000000019312bc28 D8E8E86D-85AC-3C90-B2E1-940235ECAA18 + 494632
    30  UIKitCore                           0x0000000193e38138 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 327992
    31  UIKitCore                           0x00000001949043ac __UIVIEWCONTROLLERTRANSITIONCOORDINATOR_IS_EXECUTING_ALONGSIDE_ANIMATION_BLOCK__ + 36
    32  UIKitCore                           0x00000001940cb648 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3028552
    33  UIKitCore                           0x00000001940cb518 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3028248
    34  UIKitCore                           0x0000000194919310 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 11735824
    35  UIKitCore                           0x0000000194301a50 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 5347920
    36  UIKitCore                           0x0000000193f5ee40 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1535552
    37  UIKitCore                           0x0000000193f5e308 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1532680
    38  UIKitCore                           0x0000000194148cec 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3542252
    39  UIKitCore                           0x0000000194148904 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3541252
    40  UIKitCore                           0x0000000193fbf34c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 1930060
    41  UIKitCore                           0x00000001941f4378 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4244344
    42  UIKitCore                           0x00000001941f4cd0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4246736
    43  UIKitCore                           0x00000001946131e0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8565216
    44  UIKitCore                           0x00000001941740ac 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 3719340
    45  UIKitCore                           0x0000000194613160 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8565088
    46  UIKitCore                           0x0000000193e67f30 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 524080
    47  UIKitCore                           0x000000019461220c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561164
    48  UIKitCore                           0x00000001946120fc 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8560892
    49  UIKitCore                           0x0000000194612340 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561472
    50  UIKitCore                           0x000000019513bc64 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 20266084
    51  UIKitCore                           0x0000000194f2b414 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18101268
    52  UIKitCore                           0x0000000194f2c610 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18105872
    53  FrontBoardServices                  0x00000001aac7f088 D627737B-3C6C-3308-A90C-AD705542C2B3 + 467080
    54  FrontBoardServices                  0x00000001aac7f0a4 D627737B-3C6C-3308-A90C-AD705542C2B3 + 467108
    55  FrontBoardServices                  0x00000001aac7f0a4 D627737B-3C6C-3308-A90C-AD705542C2B3 + 467108
    56  FrontBoardServices                  0x00000001aac7eb1c D627737B-3C6C-3308-A90C-AD705542C2B3 + 465692
    57  UIKitCore                           0x0000000194f2c560 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18105696
    58  UIKitCore                           0x0000000194f2be00 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18103808
    59  UIKitCore                           0x0000000194f2c410 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18105360
    60  UIKitCore                           0x0000000194612278 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561272
    61  UIKitCore                           0x0000000194612490 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 8561808
    62  UIKitCore                           0x0000000194f2c28c 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 18104972
    63  UIKitCore                           0x00000001953ef954 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 23099732
    64  UIKitCore                           0x00000001953ef7d0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 23099344
    65  UIKitCore                           0x0000000193ffe190 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2187664
    66  UIKitCore                           0x00000001940bd824 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2971684
    67  UIKitCore                           0x00000001940bd404 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 2970628
    68  FrontBoardServices                  0x00000001aac441bc D627737B-3C6C-3308-A90C-AD705542C2B3 + 225724
    69  FrontBoardServices                  0x00000001aac43d6c D627737B-3C6C-3308-A90C-AD705542C2B3 + 224620
    70  FrontBoardServices                  0x00000001aac133c8 D627737B-3C6C-3308-A90C-AD705542C2B3 + 25544
    71  FrontBoardServices                  0x00000001aac21db8 D627737B-3C6C-3308-A90C-AD705542C2B3 + 85432
    72  FrontBoardServices                  0x00000001aac21c44 D627737B-3C6C-3308-A90C-AD705542C2B3 + 85060
    73  FrontBoardServices                  0x00000001aac26114 D627737B-3C6C-3308-A90C-AD705542C2B3 + 102676
    74  libdispatch.dylib                   0x000000019935a0d0 7DE7EC03-CFB7-349D-9B9E-8782B38F231D + 16592
    75  libdispatch.dylib                   0x000000019935db14 7DE7EC03-CFB7-349D-9B9E-8782B38F231D + 31508
    76  FrontBoardServices                  0x00000001aac23300 D627737B-3C6C-3308-A90C-AD705542C2B3 + 90880
    77  FrontBoardServices                  0x00000001aac23280 D627737B-3C6C-3308-A90C-AD705542C2B3 + 90752
    78  FrontBoardServices                  0x00000001aac23158 D627737B-3C6C-3308-A90C-AD705542C2B3 + 90456
    79  CoreFoundation                      0x0000000191658328 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 353064
    80  CoreFoundation                      0x00000001916582bc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 352956
    81  CoreFoundation                      0x0000000191655dc0 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 343488
    82  CoreFoundation                      0x0000000191654fbc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 339900
    83  CoreFoundation                      0x0000000191654830 CFRunLoopRunSpecific + 588
    84  GraphicsServices                    0x00000001dd6341c4 GSEventRunModal + 164
    85  UIKitCore                           0x00000001941baeb0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4009648
    86  UIKitCore                           0x00000001942695b4 UIApplicationMain + 340
    87  FleetHDMobile                       0x00000001034d81f4 xamarin_UIApplicationMain + 60
    88  FleetHDMobile                       0x00000001037c3da4 AppleCryptoNative_X509ImportCertificate + 2886572
    89  FleetHDMobile                       0x00000001037c26a4 AppleCryptoNative_X509ImportCertificate + 2880684
    90  FleetHDMobile                       0x00000001037b70b4 AppleCryptoNative_X509ImportCertificate + 2834108
    91  FleetHDMobile                       0x00000001037b4c4c AppleCryptoNative_X509ImportCertificate + 2824788
    92  FleetHDMobile                       0x00000001037838b4 AppleCryptoNative_X509ImportCertificate + 2623164
    93  FleetHDMobile                       0x000000010372aff4 AppleCryptoNative_X509ImportCertificate + 2260476
    94  FleetHDMobile                       0x00000001037312f0 AppleCryptoNative_X509ImportCertificate + 2285816
    95  FleetHDMobile                       0x0000000103788ed0 AppleCryptoNative_X509ImportCertificate + 2645208
    96  FleetHDMobile                       0x00000001034ef2f0 xamarin_log + 22332
    97  FleetHDMobile                       0x00000001037f166c AppleCryptoNative_X509ImportCertificate + 3073140
    98  dyld                                0x00000001b7042ec8 3060D36A-16CE-3C3A-9258-3881459F5714 + 212680

   at ObjCRuntime.Runtime.ThrowNSException(IntPtr ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 564
   at UIKit.UIGraphics.BeginImageContextWithOptions(CGSize , Boolean , NFloat ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIGraphics.cs:line 92
   at Microsoft.Maui.Controls.Platform.BrushExtensions.GetBackgroundImage(UIView control, Brush brush)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutContentRenderer.UpdateBackground()
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutContentRenderer.HandleShellPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.Shell.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.AppThemeBinding.<>c__DisplayClass11_0.<ApplyCore>g__Set|0()
   at Microsoft.Maui.Controls.AppThemeBinding.ApplyCore(Boolean dispatch)
   at Microsoft.Maui.Controls.AppThemeBinding.Apply(Boolean fromTarget)
   at Microsoft.Maui.Controls.AppThemeBinding.AppThemeProxy.OnAppThemeChanged()
   at Microsoft.Maui.Controls.AppThemeBinding.AppThemeProxy.<>c.<.cctor>b__8_0(BindableObject bindable, Object oldValue, Object newValue)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.VisualElement.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Application.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Application.TriggerThemeChangedActual()
   at Microsoft.Maui.Controls.Application.set_PlatformAppTheme(AppTheme value)
   at Microsoft.Maui.Controls.Application.Microsoft.Maui.IApplication.ThemeChanged()
   at Microsoft.Maui.Platform.PageViewController.TraitCollectionDidChange(UITraitCollection previousTraitCollection)
__- End of stack trace from previous location __-
   at UIKit.UIGraphics.BeginImageContextWithOptions(CGSize , Boolean , NFloat ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIGraphics.cs:line 92
   at Microsoft.Maui.Controls.Platform.BrushExtensions.GetBackgroundImage(UIView control, Brush brush)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutContentRenderer.UpdateBackground()
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutContentRenderer.HandleShellPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.Shell.OnPropertyChanged(String propertyName)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.AppThemeBinding.<>c__DisplayClass11_0.<ApplyCore>g__Set|0()
   at Microsoft.Maui.Controls.AppThemeBinding.ApplyCore(Boolean dispatch)
   at Microsoft.Maui.Controls.AppThemeBinding.Apply(Boolean fromTarget)
   at Microsoft.Maui.Controls.AppThemeBinding.AppThemeProxy.OnAppThemeChanged()
   at Microsoft.Maui.Controls.AppThemeBinding.AppThemeProxy.<>c.<.cctor>b__8_0(BindableObject bindable, Object oldValue, Object newValue)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.VisualElement.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(Object sender, ResourcesChangedEventArgs e)
   at Microsoft.Maui.Controls.Element.OnResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Element.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Application.OnParentResourcesChanged(IEnumerable`1 values)
   at Microsoft.Maui.Controls.Application.TriggerThemeChangedActual()
   at Microsoft.Maui.Controls.Application.set_PlatformAppTheme(AppTheme value)
   at Microsoft.Maui.Controls.Application.Microsoft.Maui.IApplication.ThemeChanged()
   at Microsoft.Maui.Platform.PageViewController.TraitCollectionDidChange(UITraitCollection previousTraitCollection)
__- End of stack trace from previous location __-
   at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 61
   at UIKit.UIApplication.Main(String[] , Type , Type ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 96
   at FleetHDMobile.Program.Main(String[] args) in /Users/chuckkrutsinger/Blue_Dot_Repos/fleet-hd-mobile/src/FleetHDMobile/Platforms/iOS/Program.cs:line 16

The only line of our source in this trace is Program.cs line 16:

        UIApplication.Main(args, null, typeof(AppDelegate));

So whatever is happening upon being backgrounded, is happening deep in Maui/Xamarin/Dotnet code. Somehow, UI Code is being triggered. The presence of AppleCrypto in the stack is also interesting. I wonder if that has to do with prefences, which I believe use encryption.

mattleibow commented 1 week ago

It may be this line: https://github.com/dotnet/maui/blob/c1bb5fd2801b5a65101e97e19295d31296174a83/src/Controls/src/Core/Platform/iOS/Extensions/BrushExtensions.cs#L124

However, the stack seems to indicate that this all starts with

   at Microsoft.Maui.Controls.Application.Microsoft.Maui.IApplication.ThemeChanged()
   at Microsoft.Maui.Platform.PageViewController.TraitCollectionDidChange(UITraitCollection previousTraitCollection)

It looks like the theme is changing in the background for some reason...

I wonder if you were to implement IApplication on your app and then explicitly implement ThemeChanged and make it do nothing:

class App : Application, IApplication
{
    ...
    void IApplication.ThemeChanged(...) 
    {
        // do nothing
    }
}
ksoftllc commented 1 week ago

@mattleibow That was it! I implemented IApplication and logged it. It was being called multiple times during background.

    void IApplication.ThemeChanged()
    {
        Log.Logger.Information("theme changing");
    }

Output:

[2024-11-12 17:25:40,178][INF][:] app enters background
[2024-11-12 17:25:40,35][INF][:] theme changing
[2024-11-12 17:25:40,352][INF][:] theme changing
[2024-11-12 17:25:40,638][INF][:] theme changing
[2024-11-12 17:25:40,639][INF][:] theme changing
[2024-11-12 17:25:40,765][INF][:] theme changing
[2024-11-12 17:25:40,777][INF][:] theme changing
[2024-11-12 17:25:40,867][INF][:] theme changing
[2024-11-12 17:25:40,868][INF][:] theme changing
[2024-11-12 17:27:03,773][INF][:] resuming foreground

So how can I block these only while in background? Or is there something in my code causing all these events to fire?

ksoftllc commented 1 week ago

@mattleibow If I implement Application.ThemeChanged() and do nothing, then theme changes are blocked while in the foreground as well. Is there some way to let them through when in the foreground?

    void IApplication.ThemeChanged()
    {
        if (isInBackground) 
            return;

        // do something here to allow normal processing of theme changes
    }
ksoftllc commented 1 week ago

This repo has a simple project to reproduce the crash on backgrounding: https://github.com/ksoftllc/CrashOnBackgroundIos

mattleibow commented 3 days ago

You can let them through by doing this:

void IApplication.ThemeChanged()
{
    if (isInBackground) 
        return;
    PlatformAppTheme = AppInfo.RequestedTheme;
}
ksoftllc commented 3 days ago

@mattleibow Image

Everything I have tried is read only.