问题
My Xamarin application runs flawlessly when ran on a simulator, or on Android. The problem is arisen when I deploy it to TestFlight and attempt to run it on iOS. It's giving a very odd behavior which I've been trying to wrap my head around for some time.
About 70% of the time, the app crashes immediately on launch. Once the app crashes, you can re-launch the app and it will have no issue. Then if you restart the device, or wait hours (I'm assuming because whatever iOS's garbage collection is disposes of the application memory) the crashing comes back.
I've symbolicated my crash log and am having difficulty in deciphering where to start with it.
Here's the beginning of the stack trace, and I'll provide a link for the full stack trace at the bottom.
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4336173056
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 000000010274c000-0000000102794000 [ 288K] r-x/r-x SM=COW ...co.Mobile.iOS
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001be530df0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001be450948 pthread_kill + 228 (pthread.c:1458)
2 libsystem_c.dylib 0x00000001be3dfc24 __abort + 116 (abort.c:147)
3 libsystem_c.dylib 0x00000001be3dfbb0 abort + 116 (abort.c:118)
4 Ecco.Mobile.iOS 0x0000000105209d8c xamarin_initialize.cold.1 + 0
5 Ecco.Mobile.iOS 0x00000001052014a8 xamarin_printf + 44782760 (runtime.m:2468)
6 Ecco.Mobile.iOS 0x0000000105118f80 mono_invoke_unhandled_exception_hook + 43831168 (exception.c:1299)
7 Ecco.Mobile.iOS 0x00000001050ba76c mono_handle_exception_internal + 43444076 (mini-exceptions.c:2783)
8 Ecco.Mobile.iOS 0x00000001050b9154 mono_handle_exception + 43438420 (mini-exceptions.c:3107)
9 Ecco.Mobile.iOS 0x00000001050b0478 mono_arm_throw_exception + 43402360 (exceptions-arm64.c:401)
10 Ecco.Mobile.iOS 0x0000000102ba7a7c throw_exception + 172
11 Ecco.Mobile.iOS 0x00000001029180fc System_Runtime_ExceptionServices_ExceptionDispatchInfo_Throw + 44
12 Ecco.Mobile.iOS 0x000000010291f924 System_Runtime_CompilerServices_AsyncMethodBuilderCore__c__ThrowAsyncb__7_0_object + 84
13 Ecco.Mobile.iOS 0x0000000103880e3c Foundation_NSAsyncSynchronizationContextDispatcher_Apply + 18042428 (NSAction.cs:178)
14 Ecco.Mobile.iOS 0x0000000102b640f0 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 272
15 Ecco.Mobile.iOS 0x00000001050caab4 mono_jit_runtime_invoke + 43510452 (mini-runtime.c:3165)
16 Ecco.Mobile.iOS 0x0000000105163b9c mono_runtime_invoke_checked + 44137372 (object.c:3220)
17 Ecco.Mobile.iOS 0x0000000105167004 mono_runtime_invoke + 44150788 (object.c:3107)
18 Ecco.Mobile.iOS 0x0000000102754514 native_to_managed_trampoline_18(objc_object*, objc_selector*, _MonoMethod**, unsigned int) + 34068 (registrar.m:776)
19 Ecco.Mobile.iOS 0x0000000102755578 -[__MonoMac_NSAsyncSynchronizationContextDispatcher xamarinApplySelector] + 38264 (registrar.m:7896)
20 Foundation 0x00000001beb4ef94 __NSThreadPerformPerform + 188 (NSThread.m:807)
21 CoreFoundation 0x00000001be6c4d14 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1922)
22 CoreFoundation 0x00000001be6c4c68 __CFRunLoopDoSource0 + 84 (CFRunLoop.c:1956)
23 CoreFoundation 0x00000001be6c43c4 __CFRunLoopDoSources0 + 188 (CFRunLoop.c:1992)
24 CoreFoundation 0x00000001be6bf1fc __CFRunLoopRun + 780 (CFRunLoop.c:2882)
25 CoreFoundation 0x00000001be6bebc8 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)
26 GraphicsServices 0x00000001c8aa05cc GSEventRunModal + 164 (GSEvent.c:2246)
27 UIKitCore 0x00000001c2871744 UIApplicationMain + 1936 (UIApplication.m:4823)
28 Ecco.Mobile.iOS 0x00000001038dfa98 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 344
29 Ecco.Mobile.iOS 0x000000010382a500 UIKit_UIApplication_Main_string___intptr_intptr + 17687808 (UIApplication.cs:86)
30 Ecco.Mobile.iOS 0x000000010382a484 UIKit_UIApplication_Main_string___string_string + 17687684 (UIApplication.cs:66)
31 Ecco.Mobile.iOS 0x0000000102796334 Ecco_Mobile_iOS_Application_Main_string__ + 303924 (/<unknown>:1)
32 Ecco.Mobile.iOS 0x0000000102b640f0 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 272
33 Ecco.Mobile.iOS 0x00000001050caab4 mono_jit_runtime_invoke + 43510452 (mini-runtime.c:3165)
34 Ecco.Mobile.iOS 0x0000000105163b9c mono_runtime_invoke_checked + 44137372 (object.c:3220)
35 Ecco.Mobile.iOS 0x0000000105168c94 mono_runtime_exec_main_checked + 44158100 (object.c:5284)
36 Ecco.Mobile.iOS 0x00000001050affe0 mono_jit_exec + 43401184 (driver.c:1328)
37 Ecco.Mobile.iOS 0x0000000105208238 xamarin_main + 44810808 (monotouch-main.m:0)
38 Ecco.Mobile.iOS 0x0000000102796290 main + 303760 (main.m:312)
39 libdyld.dylib 0x00000001be53b384 start + 4
I've searched for similar instances of this issue, and have found some good information, such as this where a user broke down and narrowed the error, which I think would be what I need to get started tackling this issue, as I have very little experience working with native iOS issues.
Full stack trace: https://pastebin.com/fc2ZPQ4z
来源:https://stackoverflow.com/questions/64160138/exc-bad-access-in-test-flight