Bug 26085 - Adding Padding to ContentPage crashes iOS apps running 8.1.2
Summary: Adding Padding to ContentPage crashes iOS apps running 8.1.2
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Highest blocker
Target Milestone: 8.6.x (services rel)
Assignee: Bugzilla
URL:
: 26073 ()
Depends on:
Blocks:
 
Reported: 2015-01-15 18:05 UTC by James
Modified: 2015-01-28 15:36 UTC (History)
11 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (175.19 KB, application/zip)
2015-01-16 21:52 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
VERIFIED FIXED

Description James 2015-01-15 18:05:25 UTC
The following Code will cause an app to crash on an iOS device running 8.1.2. This was tested on an iPad Air and iPhone 6

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ClassNameHere">
  <ContentPage.Padding>
    <OnPlatform x:TypeArguments="Thickness"
                iOS="5, 20, 5, 0"
                Android="5, 0, 5, 0"
                WinPhone="5, 0, 5, 0" />
  </ContentPage.Padding>
  
  
        <Label Text="Hello Forms" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

Removing the <ContentPage.Padding> section will fix the issue.

This issue has been found on iPad Air, iPhone 6 (running 8.1.2) and iPad Mini (running 8.0).
It does not happen on the Simulator, iPhone 5 (running 8.1.2) or iPhone 4s (7.1.2). 

Using Xamarin.Forms 1.3.1.6296
Comment 1 Shruti 2015-01-16 05:21:23 UTC
I have checked this issue on iPhone 6 with creating new Forms app and implemented code given in description. I observed that app is getting crashed on iPhone 6 (iOS 8.0.2)

Supplement Info:

IDE Log: https://gist.github.com/Arpit360/1a355d632880803948c1
Application Log : https://gist.github.com/Arpit360/848d954e8a351a53b7ab.
Device Log : https://gist.github.com/Arpit360/81e13f2c0ed165659bfa

Device : iPhone 6 iOS Version 8.0.2

Environment Info:

Xamarin.Forms 1.3.1.6296
=== Xamarin Studio ===

Version 5.7.1 (build 5)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.iOS ===

Version: 8.6.0.52 (Enterprise Edition)
Hash: 7c4c2c5
Branch: 
Build date: 2015-01-08 22:29:16-0500

=== Xamarin.Mac ===

Version: 1.10.0.18 (Enterprise Edition)

=== Build Information ===

Release ID: 507010005
Git revision: ef2b158f8e0495f6b696d97f1dc0b8208577a5a8
Build date: 2015-01-15 03:32:55-05
Xamarin addins: 12ef44f5cd3bba34b1982969f0d6a8d881ed00c9

=== Operating System ===

Mac OS X 10.10.0
Darwin mac360-xamarins-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Kevin Kraemer 2015-01-16 09:56:11 UTC
fyi..

Also saw this issue with a resource using the Thickness type.  Code below also caused crash.

thanks.
Kevin.

  <ContentPage.Resources>
    <ResourceDictionary>
      <OnPlatform x:Key="controlPadding"
                  x:TypeArguments="Thickness"
                  iOS="5, 20, 5, 0"
                  Android="5, 0, 5, 0"
                  WinPhone="5, 0, 5, 0" />
    </ResourceDictionary>
  </ContentPage.Resources>
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2015-01-16 13:48:07 UTC
To add a few more searchable keywords to this bug report, I'll copy + paste the error from the Application Log in comment 1:

> Assertion: should not be reached at ../../../../../mono/mono/mini/../../../mono-extensions/mono/mini/../../../mono-extensions/mono/mini/mini-arm64-gsharedvt.c:91
>  Stacktrace:
> 
>    at <unknown> <0xffffffff>
>    at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>
>    at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00044] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
>    at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:114
>    at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (object,Xamarin.Forms.Xaml.XmlName,object,Xamarin.Forms.BindableObject,Xamarin.Forms.Xaml.INode,Xamarin.Forms.Xaml.HydratationContext,System.Xml.IXmlLineInfo) <IL 0x003f8, 0x01c0b>
>    at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ValueNode,Xamarin.Forms.Xaml.INode) <IL 0x00051, 0x003bb>
>    at Xamarin.Forms.Xaml.ValueNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor,Xamarin.Forms.Xaml.INode) <IL 0x00003, 0x00093>
>    at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor,Xamarin.Forms.Xaml.INode) <IL 0x0002e, 0x0029b>
>    at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor,Xamarin.Forms.Xaml.INode) <IL 0x0002e, 0x0029b>
>    at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject,string) <IL 0x000bf, 0x005cb>
>    at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject,System.Type) <IL 0x0002d, 0x001b7>
>    at Xamarin.Forms.Xaml.Extensions.LoadFromXaml<TView> (TView,System.Type) <0x0006f>
>    at porta.MyPage.InitializeComponent () [0x0000c] in /Users/mac360_xamarin/Projects/porta/porta/obj/Debug/MyPage.xaml.g.cs:20
>    at porta.MyPage..ctor () [0x00008] in /Users/mac360_xamarin/Projects/porta/porta/MyPage.xaml.cs:12
>    at porta.App..ctor () [0x00008] in /Users/mac360_xamarin/Projects/porta/porta/porta.cs:12
>    at porta.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication,Foundation.NSDictionary) [0x00007] in /Users/mac360_xamarin/Projects/porta/iOS/AppDelegate.cs:17
>    at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
>    at <unknown> <0xffffffff>
>    at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
>    at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
>    at UIKit.UIApplication.Main (string[],string,string) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
>    at porta.iOS.Application.Main (string[]) [0x00008] in /Users/mac360_xamarin/Projects/porta/iOS/Main.cs:17
>    at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Comment 4 Zoltan Varga 2015-01-16 21:46:11 UTC
Could somebody add a full test project ?
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-01-16 21:52:48 UTC
Created attachment 9391 [details]
Test case

Steps to reproduce:

Run the iOS app from the attached test case (tested on iPad Mini 2, iOS 8.0).
Comment 6 Tim Lewis 2015-01-17 03:23:15 UTC
This should not be a 'normal error', it is a high.  Basically in all your XAML examples you use this as essential for correcting the difference of iOs sizing.  
For example in the link below as part of the 'essential' XAML guide you give EXACTLY this as a way of correcting the issue.

http://developer.xamarin.com/guides/cross-platform/xamarin-forms/xaml-for-xamarin-forms/essential_xaml_syntax/
Comment 7 Zoltan Varga 2015-01-17 20:33:00 UTC
Fixed by mono master 8cd6feb66b61b54ee5ca0989b0e58d585a165272 and mono-extensions master d6e36bc54c9a03c4f252eba3cf7f4e71436e0269/bbfd0a3411e71e7ad3d22fcc0dce3fd5ede19f2d.
Comment 8 Jason Smith [MSFT] 2015-01-18 04:33:19 UTC
This will be resolved in the next mono update (sorry I dont know when that will be exactly)
Comment 9 Zoltan Varga 2015-01-18 10:57:22 UTC
It will be resolved in a future xamarin.ios version.
Comment 10 Rolf Bjarne Kvinge [MSFT] 2015-01-20 03:16:03 UTC
*** Bug 26073 has been marked as a duplicate of this bug. ***
Comment 11 GouriKumari 2015-01-21 15:42:13 UTC
Verified sample test case with Xamarin.iOS build, Xamarin.iOS Version: 8.6.1.16 and with devices iPadmini3, iPhone6 and iPhone5S. App launched successfully without any crash.

Logs:
Application Output:https://gist.github.com/GouriKumari/b764efde9f38afd0b7bd
Console Log: https://gist.github.com/GouriKumari/fbc68c1f77d458169bb6

Test Env:
Xamarin Studio
Version 5.7.1 (build 47)
Installation UUID: 5ed3a124-4b77-4c6f-beb9-c830fd815e2a
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

Apple Developer Tools
Xcode 6.1 (6602)
Build 6A1052c

Xamarin.iOS
Version: 8.6.1.16 (Enterprise Edition)
Hash: 6721264
Branch: 
Build date: 2015-01-21 14:27:54-0500

Device: iPadmini3 8.0, iPhone6 8.0.2 and iPhone5S 8.0
Comment 12 GouriKumari 2015-01-28 15:36:30 UTC
Fix will be included with service release XI 8.6.1.20.pkg. Hence marking this bug as Verified fixed.