Xamarin.iOS | App crash on launch when build via XCode 13.2.1

651 Views Asked by At

We have an app which works on device when built via XCode 12.5.1.

But, when we build same app via XCode 13.2.1, it crashes on launch. No crash logs as app does not finish launching.

Symbolicated native crash device log from XCode:

1   libsystem_pthread.dylib         0x00000001ddaaf9e8 pthread_kill + 212
2   libsystem_c.dylib               0x00000001a0ea79b0 __abort + 112
3   libsystem_c.dylib               0x00000001a0ea7940 __abort + 0
4   iOS                         0x0000000104492fb8 xamarin_find_protocol_wrapper_type + 30355384 (runtime.m:1177)
5   iOS                         0x0000000104359f58 mono_invoke_unhandled_exception_hook + 29073240 (exception.c:1299)
6   iOS                         0x00000001042ef0d0 mono_handle_exception_internal + 28635344 (mini-exceptions.c:2792)
7   iOS                         0x00000001042edaa4 mono_handle_exception + 28629668 (mini-exceptions.c:3116)
8   iOS                         0x00000001042e3820 mono_arm_throw_exception + 28588064 (exceptions-arm64.c:403)
9   iOS                         0x0000000102bfd07c llvm_throw_corlib_exception_abs_trampoline + 172
10  iOS                         0x00000001037d601c

No issues on Simulator. Able to deploy on Debug mode on device as well.

I will really appreciate, if any one can hint to the cause. Thanks!

UPDATE 1: Getting below exception on app launch:

System.EntryPointNotFoundException: xamarin_dyn_objc_msgSend
  at Foundation.NSObject.DangerousRetain () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:537 
  at Foundation.NSObject.CreateManagedRef (System.Boolean retain) [0x00057] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:375 
  at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0009c] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:352 
  at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:184 
  at UIKit.UIApplicationDelegate..ctor () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIApplicationDelegate.g.cs:794 
  at App.iOS.AppDelegate..ctor () <0x102e32a50 + 0x0003b> in <ec9d196a959a4ab6b62c94c294993dc9#bddc3ec2684c5a21aacd85c97b343e39>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:83 
  at App.iOS.Application.Main (System.String[] args) [0x00011] in /Users/vitthalpatil/Documents/MobileXpense/Git/App-xamarin/AppiOS/Views/Main/Main.cs:13 Previous log file is /var/mobile/Containers/Data/Application/278CCDA3-9618-422F-A592-03D801F0B263/Library/Blackbox/sc5x3wxu.7w1
2022-02-16 17:51:51.856 AppiOS[741:109556] Created /var/mobile/Containers/Data/Application/278CCDA3-9618-422F-A592-03D801F0B263/Documents/../Library/Blackbox/hdgc00m7.xi3
2022-02-16 17:51:52.025 AppiOS[741:109591] 
Unhandled Exception:
System.EntryPointNotFoundException: xamarin_dyn_objc_msgSend
  at Foundation.NSObject+NSObject_Disposer.Add (Foundation.NSObject handle) [0x00039] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:976 
  at Foundation.NSObject.Dispose (System.Boolean disposing) [0x0002c] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:928 
  at Foundation.NSObject.Finalize () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:207 
2022-02-16 17:51:52.026 AppiOS[741:109591] Unhandled managed exception: xamarin_dyn_objc_msgSend (System.EntryPointNotFoundException)
  at Foundation.NSObject+NSObject_Disposer.Add (Foundation.NSObject handle) [0x00039] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:976 
  at Foundation.NSObject.Dispose (System.Boolean disposing) [0x0002c] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:928 
  at Foundation.NSObject.Finalize () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:207 

=================================================================
    Native Crash Reporting
=================================================================
Got a abrt 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:
=================================================================
    0x105481ef4 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x105478040 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10548143c - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x1d6a23dbc - /usr/lib/system/libsystem_platform.dylib : <redacted>
    0x1d6a339e8 - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
    0x199e2b934 - /usr/lib/system/libsystem_c.dylib : abort
    0x10563b884 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : xamarin_find_protocol_wrapper_type
    0x1054e28ec - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x105590874 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x1054e4cb0 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x1055b5e78 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x1054e5e24 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x105590e8c - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x105590d10 - /private/var/containers/Bundle/Application/4FCA86E7-B50F-4EA6-9297-176CC0BA339B/AppiOS.app/AppiOS : mono_pmip
    0x1d6a32b70 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
    0x1d6a37880 - /usr/lib/system/libsystem_pthread.dylib : thread_start

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x1bbae095c):0x1bbae094c  c0 03 5f d6 c0 03 5f d6 10 29 80 d2 01 10 00 d4  .._..._..)......
0x1bbae095c  e3 00 00 54 fd 7b bf a9 fd 03 00 91 1d 76 ff 97  ...T.{.......v..
0x1bbae096c  bf 03 00 91 fd 7b c1 a8 c0 03 5f d6 c0 03 5f d6  .....{...._..._.
0x1bbae097c  90 29 80 d2 01 10 00 d4 e3 00 00 54 fd 7b bf a9  .).........T.{..

=================================================================
    Managed Stacktrace:
=================================================================
=================================================================

UPDATE 2: Managed to fix this issue by updating below tags in .csproj Release config:

Changed:

<MtouchExtraArgs>--linkskip=NETStd.Lib --linkskip=AppiOS --marshal-objectivec-exceptions=unwindmanagedcode</MtouchExtraArgs>

To

<MtouchExtraArgs>--linkskip=NETStd.Lib --linkskip=AppiOS</MtouchExtraArgs>
1

There are 1 best solutions below

0
On BEST ANSWER

Managed to fix this issue by updating below tags in .csproj Release config:

Changed:

<MtouchExtraArgs>--linkskip=NETStd.Lib --linkskip=AppiOS --marshal-objectivec-exceptions=unwindmanagedcode</MtouchExtraArgs>

To

<MtouchExtraArgs>--linkskip=NETStd.Lib --linkskip=AppiOS</MtouchExtraArgs>

Raised issue in xamarin-macios to track the issue, and a fix if required.