AppCenter Start is crashing in Xamarin forms app build and deployed to connected iPhone

Miner Dev 16 Reputation points
2021-08-12T22:17:56.023+00:00

I call AppCenter.Start in my app's OnStart method. This works fine if I build and deploy to an iOS simulator BUT if I build and deploy to a connected iPhone I get the following crash on start up:

[0:] An error occurred: 'Could not create an native instance of the type 'Microsoft.AppCenter.iOS.Bindings.MSACWrapperSdk': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: ' at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0002e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:247
at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:147
at Microsoft.AppCenter.iOS.Bindings.MSACWrapperSdk..ctor (System.String wrapperSdkVersion, System.String wrapperSdkName, System.String >wrapperRuntimeVersion, System.String liveUpdateReleaseLabel, System.String liveUpdateDeploymentKey, System.String liveUpdatePackageHash) <0x114830990 + >0x0000a> in <ec0f0f70541d48dcbe5905e6d8ddf187>:0
at Microsoft.AppCenter.AppCenter.SetWrapperSdk () <0x11482ff58 + 0x00012> in <e3f0b909e1aa4c5e99f60c97981cd946>:0
at Microsoft.AppCenter.AppCenter.PlatformStart (System.String appSecret, System.Type[] services) <0x11482fc70 + 0x00002> in ><e3f0b909e1aa4c5e99f60c97981cd946>:0
at Microsoft.AppCenter.AppCenter.Start (System.String appSecret, System.Type[] services) <0x11482f768 + 0x00008> in <e3f0b909e1aa4c5e99f60c97981cd946>:0

Using Visual Studio Professional 2019 16.11

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,061 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Adolfo 6 Reputation points
    2021-10-03T16:09:14.223+00:00

    I had similar error while upgrading VS to version 16.11.3 and I was able to get passed this by following this: https://stackoverflow.com/questions/32999376/how-do-i-set-monotouch-objcruntime-class-throwoninitfailure-to-false

    I added this line to my AppDelegate.cs FinishedLaunching method:

    ObjCRuntime.Class.ThrowOnInitFailure = false;
    

    I know this is not solving the root cause but at least my app is not crashing anymore.


  2. Rob Caplan - MSFT 5,412 Reputation points Microsoft Employee
    2022-01-25T23:09:54.847+00:00

    For problems with App Center please contact App Center support via the App Center portal.
    See https://learn.microsoft.com/en-us/appcenter/help

    0 comments No comments