Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 15542 [details]
Xcode Device log with crash details
Non-debug iOS build of Xamarin.Forms app crashes on app start-up.
Both Ad-Hoc and Release builds crash UNLESS I Enable Debugging in the Project Options > Build > iOS Debug menu.
Issue started after previous Xamarin Studio update.
See attached Device Log and Xamarin Studio details.
Xamarin Studio Details:
=== Xamarin Studio ===
Version 5.10.3 (build 27)
Installation UUID: afeaddc5-3486-4773-9877-a4d9f13a014c
Mono 4.2.3 (explicit/832de4b)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402030004
=== Xamarin.Profiler ===
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Xamarin.Android ===
Version: 184.108.40.206 (Business Edition)
Android SDK: /Users/martin/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.1
Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Android Designer EPL code available here:
=== Xamarin Android Player ===
Location: /Applications/Xamarin Android Player.app
=== Xamarin Inspector ===
Build date: Tue Feb 16 21:30:06 UTC 2016
=== Apple Developer Tools ===
Xcode 7.2.1 (9548.1)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Business Edition)
Build date: 2016-03-21 20:13:04-0400
=== Xamarin.Mac ===
=== Build Information ===
Release ID: 510030027
Git revision: 8dc6bca63f5cd93719a093973e74de6999864193
Build date: 2016-03-17 17:13:33-04
Xamarin addins: 45239909442742bdee83a0c0f77eecb8a08bedfa
Build lane: monodevelop-lion-cycle6-c6sr2
=== Operating System ===
Mac OS X 10.11.4
Darwin Martins-MacBook-Pro.local 15.4.0 Darwin Kernel Version 15.4.0
Fri Feb 26 22:08:05 PST 2016
Minimally we'll need to see your full build log (with `-v -v -v -v` to get all details) for both your release (non working) and debug (working) builds.
Please do a "clean" before rebuilding them so the logs will include all the steps. Thanks!
Created attachment 15649 [details]
Working build [Ad-hoc with Debug Enabled]
Created attachment 15650 [details]
Broken build [Ad-hoc with Debug Disabled]
There seems to be a mistake in your attachments. In both log files I can see that `Debug: True` (form msvbuild) and that `mtouch` is called with a `--debug` argument.
Architectures: ARMv7, ARM64
Either the 2nd log file is incorrect or the difference between your builds is not related to the debug setting.
Created attachment 15680 [details]
Ad-hoc with Debug Disabled
Sorry about that; this is the correct Build Output log for the Debug Disabled
In general such issues are often related different linker settings (your crash report hints at something missing).
However nothing stands out in the logs. It could be something else (e.g. codegen) but that has not changed since 9.4.0 so that would be very unlucky...
Back to your original crash report we can see:
7 <redacted> 0x0000000101cb0538 print_exception(MonoObject*, bool, NSMutableString*) (runtime.m:782)
That means the mono runtime has written additional details in the device console logs (can be accessed by XS or Xcode). Can you run this again and attach the device logs ? Thanks!
Would that be in the Application Output window in Xamarin Studio? It is empty :|
No, the device logs can be access from Xamarin Studio by
- click on View menu;
- click on Pads sub-menu;
- click on iOS Device Log item;
A new pad will be shown, with a combo box for devices. Select the one you want to execute from and then click on connect.
An alternative is to use Xcode:
- click on Windows menu
- click on Devices item;
- select the device (left);
- click on the small square+triangle icon (status bar)
In both cases you'll see the device logs, which includes a lot more information than what's being produced by your application.
Created attachment 15682 [details]
Xamarin Studio iOS Device Log
TIL how to view iOS Device Logs in XS!
To double-check, I used the same build config, and just Enabled Debug and the app ran without crashing
System.TypeInitializationException: The type initializer for '<redacted>.App' threw an exception. ---> System.InvalidOperationException: You MUST call Xamarin.Forms.Init(); prior to using it.
^ is there any reason (e.g. conditional compilation) that could make this call be skipped ?
or maybe it's some extra XF code that is called before the Init call ? the rest of the stacktrace makes it looks it happens very early in the application life.
at Xamarin.Forms.Device.get_PlatformServices () <0x100b579c0 + 0x0005c> in <filename unknown>:0
at Xamarin.Forms.Device.GetNamedSize (NamedSize size, System.Type targetElementType, Boolean useOldSizes) <0x100b57c30 + 0x00017> in <filename unknown>:0
at Xamarin.Forms.Device.GetNamedSize (NamedSize size, System.Type targetElementType) <0x100b57c00 + 0x0001f> in <filename unknown>:0
at <redacted>.App.SendStart () <0x1000ab910 + 0x005eb> in <filename unknown>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string,intptr,intptr)
global::Xamarin.Forms.Forms.Init (); is the first line of code in AppDelegate.FinishedLaunching(). No other application code gets executed before that.
No conditional compilation to skip this call.
Only happens if Debug Enabled is not checked.
(In reply to martin from comment #12)
> global::Xamarin.Forms.Forms.Init (); is the first line of code in
> AppDelegate.FinishedLaunching(). No other application code gets executed
> before that.
Type initializers can be executed at any point (as long as it happens before the type is used).
In this case the type initializer for <redacted>.App is executed before AppDelegate.FinishedLaunching, and that type initializer calls Xamarin.Forms code that require Xamarin.Forms.Init to have been called, thus the exception.
You need to change your type initializer to either call Xamarin.Forms.Init, or not do anything in any type initializer that require Xamarin.Forms.Init to have been called.
When the object's type initializer is executed, the object's constructor is executed first, correct?
A type initializer/constructor will always execute before an instance constructor.
So I am unable to find where the Type initializer for App is called in the (non-debug) program execution. I can give you access to the repo on Bitbucket?
Thanks, have added you.
So we need to do an App Store build by 29/04/2016. I preferably don't want to do it with Debug Enabled.
Any ETA on this issue?
I did a Release build from the head  of your master branch and the application starts without a crash. That's using our `cycle7` (XI 9.8), currently in the beta channel.
I'll do another build tonight after switching to `cycle6` (our current stable) tree.
 revision aee97e29f7ffa8751f189f799bc0cedfc527975d
The only other difference is that I'm using Xcode 7.3 (not 7.2) but that should not cause an issue like this one.
A release build made with 18.104.22.168 (what's presently in the stable channel) also works. The application starts, without crashing, and I see "swipe for more" and two buttons "Create Account" and "Sign In". Also tried with AdHoc configuration, with same positive results.
Either you have:
(a) fixed this earlier;
(b) something that's not committed;
(c) a weird issue because Xcode 7.2 was used; or
(d) something else misconfigured/corrupted on your Mac
I just reproduced this with the following params:
1 - edge branch
2 - Release build to physical iPhone 6 running iOS 9.3.1
3 - double-check that Debug Enabled NOT checked
4 - app crashed on startup
To confirm, I am using Xcode 7.3
I can duplicate with your branch. It looks like you're running into a race.
Debug executable are slower (and bigger) so Init has completed before you get the suspended call back called, which calls into your code. It works because Init was called.
OTOH for release the execution timing differs and you run this code (subclass)
(from device log)
at OurHood.Mobile.App.SendStart () <0x6ff28 + 0x007c3> in <filename unknown>:0
called before the Xamarin.Forms.Forms.Init method is called from FinishedLaunching
(from crash report)
21 UIKit 0x296ef8ff -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 395
I moved the initialization to
static AppDelegate ()
and it works again (it's forcing the execution of Init to happen earlier).
That might not be a perfect fix (not sure about everything Init does) so you might want to ask on forums how people deal with this kind of situation.