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.27k stars 1.76k forks source link

iOS app crashes on startup after distributing through TestFlight #17405

Closed vikern22 closed 9 months ago

vikern22 commented 1 year ago

Description

Hi!

We are struggling with a crash occuring on startup (almost instantly) on our iOS app, but only when distributed through TestFlight(locally it works fine).

I saw someone else having this issue on [(https://github.com/dotnet/maui/issues/11276)], but it doesn't seem like that was resolved.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

7.0.92

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS >= 16.6

Did you find any workaround?

No response

Relevant log output

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016f733ff8
Exception Codes: 0x0000000000000002, 0x000000016f733ff8
VM Region Info: 0x16f733ff8 is in 0x16f730000-0x16f734000;  bytes after start: 16376  bytes before end: 7
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_SMALL             11e800000-11f000000 [ 8192K] rw-/rwx SM=PRV  
      GAP OF 0x50730000 BYTES
--->  STACK GUARD              16f730000-16f734000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                    16f734000-16f830000 [ 1008K] rw-/rwx SM=PRV  thread 0
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [2601]
JohnHDev commented 1 year ago

You need to add crash analytics to your project, we have a .NET MAUI prototype app deploying successfully via TestFlight, previously with 7.0.92, now with .NET 8 RC1.

jsuarezruiz commented 1 year ago

Do you have more info?, could you share some logs from the analytics etc?

vikern22 commented 1 year ago

Seems to be working now with UseInterpreter=true, but could do a test build without interpreter when we have implemented AppCenter crash reports

tentom commented 1 year ago

From the little that has been provided I seem to experience the same issue.

Release build crashes in TestFlight and deployed locally via Ad-Hoc signing and upload with USB cable to device.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016f83fff8
Exception Codes: 0x0000000000000002, 0x000000016f83fff8
VM Region Info: 0x16f83fff8 is in 0x16f83c000-0x16f840000;  bytes after start: 16376  bytes before end: 7
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      mapped file              10b800000-10d500000 [ 29.0M] r--/r-- SM=ALI  ...t_id=aac0927d
      GAP OF 0x6233c000 BYTES
--->  STACK GUARD              16f83c000-16f840000 [   16K] ---/rwx SM=NUL  ... for thread 0
      Stack                    16f840000-16f93c000 [ 1008K] rw-/rwx SM=PRV  thread 0
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [3698]

I do also have some stack trace:

Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                         0x181dafc60 __exceptionPreprocess + 216
1   libobjc.A.dylib                        0x1995dbee4 objc_exception_throw + 56
2   CompanyName                                xamarin_unhandled_exception_handler (in CompanyName) (runtime.m:1131)
3   CompanyName                                native_to_managed_trampoline_3(objc_object*, objc_selector*, _MonoMethod**, objc_object*, objc_object*, unsigned int) (in CompanyName) (registrar.mm:190)
4   CompanyName                                -[Microsoft_Maui_MauiUIApplicationDelegate application:didFinishLaunchingWithOptions:] (in CompanyName) (registrar.mm:9557)
5   UIKitCore                              0x184361574 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 336
6   UIKitCore                              0x184535d98 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3508
7   UIKitCore                              0x18451f4bc -[UIApplication _runWithMainScene:transitionContext:completion:] + 1176
8   UIKitCore                              0x18438d284 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 148
9   UIKitCore                              0x1841f3fa8 _UIScenePerformActionsWithLifecycleActionMask + 96
10  UIKitCore                              0x1843169dc __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 188
11  UIKitCore                              0x18442c008 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 240
12  UIKitCore                              0x184654434 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 744
13  UIKitCore                              0x1845e4174 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 336
14  UIKitCore                              0x1841f4cf4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 188
15  UIKitCore                              0x1842b08e4 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 812
16  UIKitCore                              0x1841f6a84 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 248
17  UIKitCore                              0x1842db134 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 356
18  UIKitCore                              0x184730f38 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.578 + 772
19  UIKitCore                              0x18422472c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248
20  UIKitCore                              0x1842664cc -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 264
21  UIKitCore                              0x184391cec -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 560
22  UIKitCore                              0x1842d9550 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360
23  FrontBoardServices                     0x192f3bc50 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 412
24  FrontBoardServices                     0x192f5df98 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 + 100
25  FrontBoardServices                     0x192f1ebdc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232
26  FrontBoardServices                     0x192f1ffd4 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 312
27  libdispatch.dylib                      0x181a70094 _dispatch_client_callout + 16
28  libdispatch.dylib                      0x181a13150 _dispatch_block_invoke_direct$VARIANT$mp + 220
29  FrontBoardServices                     0x192f202ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40
30  FrontBoardServices                     0x192f1f7c0 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176
31  FrontBoardServices                     0x192f23960 -[FBSSerialQueue _performNextFromRunLoopSource] + 24
32  CoreFoundation                         0x181dd0448 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
33  CoreFoundation                         0x181de0578 __CFRunLoopDoSource0 + 204
34  CoreFoundation                         0x181d22734 __CFRunLoopDoSources0 + 256
35  CoreFoundation                         0x181d27e08 __CFRunLoopRun + 768
36  CoreFoundation                         0x181d3b174 CFRunLoopRunSpecific + 572
37  GraphicsServices                       0x1a2856988 GSEventRunModal + 160
38  UIKitCore                              0x18453da88 -[UIApplication _run] + 1080
39  UIKitCore                              0x1842d6f78 UIApplicationMain + 336
40  CompanyName                                xamarin_UIApplicationMain (in CompanyName) (bindings.m:131)
41  CompanyName                                wrapper_managed_to_native_UIKit_UIApplication_xamarin_UIApplicationMain_int_intptr_intptr_intptr_intptr_ (in CompanyName) + 176
42  CompanyName                                Microsoft_iOS_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (in CompanyName) (UIApplication.cs:58)
43  CompanyName                                mono_jit_runtime_invoke (in CompanyName) (mini-runtime.c:3637)
44  CompanyName                                mono_runtime_invoke_checked (in CompanyName) (object.c:2758)
45  CompanyName                                0mono_runtime_exec_main_checked (in CompanyName) (object.c:4741)
46  CompanyName                                mono_jit_exec (in CompanyName) (driver.c:1314)
47  CompanyName                                xamarin_main (in CompanyName) (monotouch-main.m:0)
48  CompanyName                                main (in CompanyName) (main.arm64.mm:377)
49  dyld                                   0x1051f04d0 start + 444

And from Thred0:

0   libsystem_pthread.dylib                0x1dd1d0978 ___chkstk_darwin + 60
1   libunwind.dylib                        0x1dd1eb040 libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_arm64>::step() + 44
2   libunwind.dylib                        0x1dd1ec5e8 _Unwind_RaiseException + 380
3   libc++abi.dylib                        0x1996d5b58 __cxa_throw + 124
4   libobjc.A.dylib                        0x1995dc01c objc_exception_throw + 368
5   CompanyName                                xamarin_process_managed_exception (in CompanyName) (runtime.m:2383)
6   CompanyName                                mono_handle_exception_internal (in CompanyName) (mini-exceptions.c:2332)
7   CompanyName                                mono_handle_exception (in CompanyName) (mini-exceptions.c:2621)
8   CompanyName                                mono_arm_throw_exception (in CompanyName) (exceptions-arm64.c:404)
9   CompanyName                                throw_exception (in CompanyName) + 172
10  CompanyName                                Microsoft_iOS_ObjCRuntime_Runtime_ThrowNSException_intptr (in CompanyName) (Runtime.cs:507)
11  CoreFoundation                         0x181e2a438 __handleUncaughtException + 708
12  libobjc.A.dylib                        0x1995e18ec _objc_terminate() + 112
13  libc++abi.dylib                        0x1996d3280 std::__terminate(void (*)()) + 16
14  libc++abi.dylib                        0x1996d5ba0 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 32
15  libc++abi.dylib                        0x1996d5b60 __cxa_throw + 132
16  libobjc.A.dylib                        0x1995dc01c objc_exception_throw + 368
17  CompanyName                                xamarin_process_managed_exception (in CompanyName) (runtime.m:2383)
18  CompanyName                                mono_handle_exception_internal (in CompanyName) (mini-exceptions.c:2332)
19  CompanyName                                mono_handle_exception (in CompanyName) (mini-exceptions.c:2621)
20  CompanyName                                mono_arm_throw_exception (in CompanyName) (exceptions-arm64.c:404)
21  CompanyName                                throw_exception (in CompanyName) + 172
22  CompanyName                                Microsoft_iOS_ObjCRuntime_Runtime_ThrowNSException_intptr (in CompanyName) (Runtime.cs:507)
23  CoreFoundation                         0x181e2a438 __handleUncaughtException + 708
24  libobjc.A.dylib                        0x1995e18ec _objc_terminate() + 112
25  libc++abi.dylib                        0x1996d3280 std::__terminate(void (*)()) + 16
26  libc++abi.dylib                        0x1996d5ba0 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 32
27  libc++abi.dylib                        0x1996d5b60 __cxa_throw + 132
28  libobjc.A.dylib                        0x1995dc01c objc_exception_throw + 368

...  The same is repeating here for 500 lines.

497 CompanyName                                xamarin_process_managed_exception (in CompanyName) (runtime.m:2383)
498 CompanyName                                mono_handle_exception_internal (in CompanyName) (mini-exceptions.c:2332)
499 CompanyName                                mono_handle_exception (in CompanyName) (mini-exceptions.c:2621)
500 CompanyName                                mono_arm_throw_exception (in CompanyName) (exceptions-arm64.c:404)
501 CompanyName                                throw_exception (in CompanyName) + 172
502 CompanyName                                Microsoft_iOS_ObjCRuntime_Runtime_ThrowNSException_intptr (in CompanyName) (Runtime.cs:507)
503 CoreFoundation                         0x181e2a438 __handleUncaughtException + 708
504 libobjc.A.dylib                        0x1995e18ec _objc_terminate() + 112
505 libc++abi.dylib                        0x1996d3280 std::__terminate(void (*)()) + 16
506 libc++abi.dylib                        0x1996d5ba0 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 32
507 libc++abi.dylib                        0x1996d5b60 __cxa_throw + 132
508 libobjc.A.dylib                        0x1995dc01c objc_exception_throw + 368
509 CompanyName                               xamarin_process_managed_exception (in CompanyName) (runtime.m:2383)
510 CompanyName                                mono_handle_exception_internal (in CompanyName) (mini-exceptions.c:2332)

It appears to be some kind of infinite loop in the FinishedLaunching function.. But the stack trace did not help me to much. I have tried to add:

<UseInterpreter>true</UseInterpreter>
<NoSymbolStrip>true</NoSymbolStrip
<MtouchLink>SdkOnly</MtouchLink>

To the project file without any change in behaviour, as suggested in some of the other recent issues that have been postet with problems launching the app with release build configuration.

The crash report was gathered from a device running iOS 15.7.9, but the app crashes on newer devices as well (iOS 17). Im currently using .Net8-RC1 MAUI and working on a Mac mini with M1

kursatoguz commented 1 year ago

I have the same problem, do you have any other suggestions?

tentom commented 1 year ago

@kursatoguz

I managed to solve this problem by downgrading Xcode to 14.3.1 and building against .net7.

So this leave me in a state where I have a broken app due to some bugs in maui net7 and I can't upgrade to net8 due to this runtime error in release mode

I have seen @rolfbjarne working on similar errors before, maybe he can shed some light on how to proceed to debug this issue and find a solution, because that stack trace does not lead me any where and since it is a release build the debugger is of little help since this issue is not triggered in debug builds.

I have also added:

<UseInterpreter>true</UseInterpreter>
<NoSymbolStrip>true</NoSymbolStrip>
<MtouchLink>SdkOnly</MtouchLink>

To the project file to see if that helped as reported in other similar issues. No symbol strip gave the same stack trace as above. And nothing else seems to have changed.

matt-goldman commented 1 year ago

We've been seeing this issue too. Nothing to contribute to the investigation, but if it helps anyone get over the line for now, we've found that a clean and rebuild and then redistribute usually resolves it.

rolfbjarne commented 1 year ago

This is the important part of the crash report:

Last Exception Backtrace:
0   CoreFoundation                         0x181dafc60 __exceptionPreprocess + 216
1   libobjc.A.dylib                        0x1995dbee4 objc_exception_throw + 56
2   CompanyName                                xamarin_unhandled_exception_handler (in CompanyName) (runtime.m:1131)
3   CompanyName                                native_to_managed_trampoline_3(objc_object*, objc_selector*, _MonoMethod**, objc_object*, objc_object*, unsigned int) (in CompanyName) (registrar.mm:190)
4   CompanyName                                -[Microsoft_Maui_MauiUIApplicationDelegate application:didFinishLaunchingWithOptions:] (in CompanyName) (registrar.mm:9557)

This is an unhandled managed exception in the DidFinishLaunching method (or deeper in managed code, called from DidFinishLaunching).

The stack overflow later occurs is a bug later on when we try to process the unhandled exception (in other words: the problem is the unhandled managed exception, fixing the stack overflow won't prevent the app from crashing)

I would start diagnosing this by getting the device log, and see if something interesting is printed there (the actual managed exception should be): https://support.apple.com/guide/console/log-messages-cnsl1012/mac

Kbmobi commented 1 year ago

I also have nothing to add except the frustration of being able to run the app through Debug without issue, but making an AdHoc build via GitHub Actions crashes on launch. Tried to use AppCenter for crash log, but doesn't even get to the initialization (maybe it's appcenter crashing it)

rolfbjarne commented 1 year ago

@Kbmobi try building the same configuration locally to see if you can reproduce with a local build, that makes it much easier to diagnose.

naaeef commented 10 months ago

Hello, I receive a similar error on iOS

=================================================================81C6
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

An error has occurred in the native fault reporting. Some diagnostic information will be unavailable.

=================================================================
    Native stacktrace:
=================================================================
    0x1065a0280 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    0x1065502a0 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_handle_native_crash
    0x1065a0280 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    0x1064b785c - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
    0x1065502a0 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_handle_native_crash
    0x1064b785c - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
    0x1cc0a7c80 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x1065a4074 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_interp_exec_method
    0x1cc0a7c80 - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x1065a19f0 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : interp_runtime_invoke
    0x1065a3e1c - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_interp_exec_method
    0x1065a19f0 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : interp_runtime_invoke
    0x1064baa94 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    0x1064baa94 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    0x106675b78 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
    0x106675b78 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
    0x10668f690 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : start_wrapper
    0x10668f690 - /Users/username/Library/Developer/CoreSimulator/Devices/08F229E3-F8A0-4E65-81C6-39324A94F250/data/Containers/Bundle/Application/ABB39697-0F60-489B-80A5-1F4BC9277267/app.name/libmonosgen-2.0.dylib : start_wrapper
    0x1cc0b3428 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
    0x1cc0b3428 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
    0x1cc0ae648 - /usr/lib/system/libsystem_pthread.dylib : thread_start

Exiting early due to double fault.

Does anyone know a solution for this or a way how to get more logs?

I already added the following config:

<UseInterpreter>true</UseInterpreter>
<NoSymbolStrip>true</NoSymbolStrip>
<MtouchLink>SdkOnly</MtouchLink>

Thank you for your help.

rolfbjarne commented 10 months ago

@naaeef do you get the same crash on device? What happens if you disable the interpreter (if it still crashes, please post an updated stack trace)?

naaeef commented 10 months ago

Hi @rolfbjarne Thank you for your response.

rolfbjarne commented 10 months ago

Hi @rolfbjarne Thank you for your response.

  • Yes it is the same on a physical device
  • I can't build without the interpreter, it fails with the following error
Instruction does not dominate all uses!
  %15 = notail call monocc noalias nonnull align 8 ptr @p_4_plt_appname_wrapper_alloc_object_AllocSmall_intptr_intptr_llvm(i64 %14, i64 144), !dbg !46065, !managed_name !20138
  call void @p_23_plt_appname__jit_icall_mono_arch_throw_exception_llvm(ptr %15), !dbg !46065

I've never seen that error before.

Can you create at test project, and attach it to a new issue here: https://github.com/xamarin/xamarin-macios/issues/new?

naaeef commented 10 months ago

@rolfbjarne Do you think the SIGSEGV error will be resolved once I can build it without the interpreter?

rolfbjarne commented 10 months ago

@rolfbjarne Do you think the SIGSEGV error will be resolved once I can build it without the interpreter?

No, I think they're two separate issues.

MichaelSL commented 9 months ago

I have a similar issue which I was able to workaround using the Interpreter. Now my not-so-fast app is even slower. Is there any way to determine / influence AOT to be able to include all necessary code without using Interpreter?

rolfbjarne commented 9 months ago

I have a similar issue which I was able to workaround using the Interpreter. Now my not-so-fast app is even slower. Is there any way to determine / influence AOT to be able to include all necessary code without using Interpreter?

You can try doing this (and remove the UseInterpreter=true property):

<PropertyGroup>
    <MtouchInterpreter>-all</MtouchInterpreter>
</PropertyGroup>

This will enable the interpreter for the app, then turn it off for every assembly. This can make some features work, and hopefully the ones you need.

Sztub commented 9 months ago

@naaeef @tentom I had a very similar error. It turns out i had a typo in StaticResource key. App was running fine on ios and android in debug mode but was crashing in release mode on physical device. So in my case it was related with this issue : 20018

MichaelSL commented 9 months ago

@rolfbjarne

<PropertyGroup>
    <MtouchInterpreter>-all</MtouchInterpreter>
</PropertyGroup>

helped. Thank you!

Should I close this one as there is a workaround, or do you want to track it here?

vikern22 commented 9 months ago
<PropertyGroup>
    <MtouchInterpreter>-all</MtouchInterpreter>
</PropertyGroup>

Crashes instantly on startup for us(now on dotnet 8)

rolfbjarne commented 9 months ago

@vikern22 please get a crash report and device log that shows the crash, that way we can start investigating what's actually happening.

vikern22 commented 9 months ago

@rolfbjarne Our QA deleted the reports before testing the crash, but no new crash logs appear

czmirek commented 9 months ago

My app is not starting in a release for TestFlight with this exact exception. The stack trace is completely useless, the exception info EXC_BAD_ACCESS (SIGSEGV) looks like a memory leak outside my code.

I did not think that looking at the device log (thanks for mentioning that @rolfbjarne ) would help. But surprisingly there is a clear log about what's happening, the actual Exception message.

image

I now know that I have a stupid bug in there that shows only in release because my release pipeline is doing some changes in the code base.

anpin commented 9 months ago

Try to rename your entitlements file to something like 'Entitlements_release.plist' and then use it your project file as in '<CodesignEntitlements>Platforms/iOS/Entitlements_release.plist</CodesignEntitlements>'

On Sun, Feb 25, 2024 at 6:47 PM, Miroslav Thompson @.***> wrote: My app is not starting in a release for TestFlight with this exact exception. The stack trace is completely useless, the exception info EXC_BAD_ACCESS (SIGSEGV) looks like a memory leak outside my code. I did not think that looking at the device log (thanks for mentioning that @rolfbjarne ) would help. But surprisingly there is a clear log about what's happening, the actual Exception message. image.png (view on web) I now know that I have a stupid bug in there that shows only in release because my release pipeline is doing some changes in the code base.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jfversluis commented 9 months ago

OK so reading through here I think the original issue has at least a workaround and other people that reported here have found out it's related or some exception in their code.

If someone still has issues with this please open an issue directly on the .NET for iOS repo as this is where this actually originates. Together with the device and crash logs as indicated above!