Xamarin.Forms app crashes in release mode on iOS device

EricDooleyEricDooley USMember ✭✭
edited June 2017 in Visual Studio

We have a major project that we have been releasing iterative Ad Hoc builds to our client for months now without problem. Now, since our last build (and at least one or two IDE updates later), we can no longer do a release build of any kind without it crashing immediately upon launching the app (doesn't make it past the splash screen). Here's a breakdown of what happens:

Debug mode on iPhone Simulator --> Works
Release mode on iPhone Simulator --> Works
Debug mode on iOS Device --> Works
Release mode on iOS Device --> Builds/deploys but immediately crashes on launch

We have tried almost every build variant imaginable at this point, but it was working fine with the configuration we had up until recently. We tried checking out previous tags from builds we know worked before but to no avail. This tells me it's an environment/IDE problem.

Here is a symbolicated crash log from our iPad running iOS 10.3.1: https://pastebin.com/Xr3uq6wH. One of the lines was unable to symbolicate (even manually with atos) for whatever reason, but I don't think it makes a difference, as it appears to be framework-level.

Here are all the version numbers for Visual Studio / OSX / etc: https://pastebin.com/5tTcTMB2

Is there an easy way to roll back Visual Studio for Mac Community??

Tagged:

Best Answer

Answers

  • EricDooleyEricDooley USMember ✭✭
    Accepted Answer

    @JGoldberger You're a lifesaver! Once I ran the Device Log and inspected it, I was able to pull a meaningful output and search for an answer:

    https://forums.xamarin.com/discussion/20320/failed-to-run-on-the-device-failed-to-load-aot-module

    Sadly it was as simple as Clean / Rebuild All :neutral: I should've known to try that! Thanks again man!!

  • Greg767Greg767 CHMember ✭✭

    Hi,
    I am getting witless here...
    Having the exact same symptoms but a simple clean and rebuild doesn't solve it!!
    It seems that its from the last Visual Studio Mac update and basically the problem is that whatever plugin I try to instantiate in AppDelegate -> FinishedLaunching it throws this:

    MessageSystem.NullReferenceException: Object reference not set to an instance of an objectXamarin Exception Stack: at MR.Gestures.iOS.iOSGestureHandler..ctor (MR.Gestures.IGestureAwareControl element, MR.Gestures.IGestureListener listener) <0x101595ce4 + 0x00040> in <691c82f2c148469a94eb4ca092d23165#6b08cc8e2e48b4c74c50ffa6b9daec16>:0 at MR.Gestures.iOS.iOSGestureHandler.GetInstance (MR.Gestures.IGestureAwareControl control) <0x1015955d8 + 0x0006f> in <691c82f2c148469a94eb4ca092d23165#6b08cc8e2e48b4c74c50ffa6b9daec16>:0 at MR.Gestures.iOS.Renderers.AbsoluteLayoutRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) <0x10159bb04 + 0x00037> in <691c82f2c148469a94eb4ca092d23165#6b08cc8e2e48b4c74c50ffa6b9daec16>:0
    at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) <0x100949c60 + 0x00277> in <6651947f7635409e9ce165761a533ac0#6b08cc8e2e48b4c74c50ffa6b9daec16>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer Aug 22 14:24:39 iPhone-Elopsis securityd[100] <Notice>: deleted <keys,rowid=347,cdat=2017-08-22 12:14:44 +0000,mdat=2017-08-22 12:14:44 +0000,kcls=1,labl=null,alis=null,perm=1,priv=1,modi=1,klbl=A3C1AD520E9AD3D2E426CF23B1CE3C6D422C9331,atag=636F6D2E676F6F676C652E6969642D7C4B7C,crtr=0,type=42,bsiz=2048,esiz=2048,sdat=2001-01-01 00:00:00 +0000,edat=2001-01-01 00:00:00 +0000,sens=0,asen=0,extr=1,next=0,encr=0,decr=1,drve=0,sign=1,vrfy=0,snrc=0,vyrc=0,wrap=0,unwp=1,data=06ea:0300008006000000...|1b06284818d140b,agrp=E3Z4NPFAQ3.ch.elopsis.grat-ici,pdmn=ak,sync=0,tomb=0,sha1=21B7E0286171A7DFBF82BEAA3388037797A6F15B,vwht=null,tkid=null,v_Data=<?>,v_pk=474428379527D79556BDA6259042410FFD8041FA,accc=310C300A0C0470726F740C02616B,u_Tomb=null,musr=> from <SecDbConnection rw open>

    Now it talks about the MR.Gestures plugin, but if I want to initialize something else before then its that, so its for sure its not whatever plugin that is the problem.
    Also I already have published the app on the app store and in multiple TestFlight versions that work.
    Its just started to happen without any major modification if its not the latest Visual Studio Mac update with Mono update and all...

    Debug works as expected on the same device.
    I wanted to reinstall the NugetPackages but with the Visual Studio update the Nuget console doesn't work anymore... It seems that I will need to do it by hand..

    @JGoldberger any ideas about this?

    Many thanks,
    Greg

  • Greg767Greg767 CHMember ✭✭

    Really weird, because I changed the order of the initialization methods of the plugins that are in FinishedLaunching and it started to work in release as well..

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Weird, glad you got that sorted out.

    I have no idea why the order of initializing plugins would cause the exception only in a release build. I would suspect some linker issue. Can you still recreate the issue? If so can you tell me what plugins are involved and the order you are initializing them to get the exception in Release? If you can get back to the state where it is failing in release, can you set the iOS Project Options -> iOS BUIld -> Linker Behavior to "Don't Link"? Also what was that Linker Behavior set to before you found the cause? If you were using the "Link All" setting, then all bets are off (IOW you would have to add some Linker properties to preserve any namespaces/types/members that may have been stripped away by the Linker). If you were using "Link Framework SDKs Only" then we likely need get a bug report filed.

  • SheemuSheemu USMember ✭✭

    Hi @EricDooley, please tell me how did solve it.

  • paul_macpaul_mac Member ✭✭✭
    edited June 26

    In my case, the status of distribution provisioning profile was invalid for some reason in the Apple Member center. Maybe due to change in Apple license agreement..!

    1. Accept the latest license agreement by logging-in as the Account holder
    2. Once I clicked on that distribution profile -> Save -> download -> doubule-click to install to xcode and rebuild the ios project for IPA, now my release app works fine...
Sign In or Register to comment.