Bug 30918 - Creating BindableProperty to a double value causes app crash.
Summary: Creating BindableProperty to a double value causes app crash.
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.10
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-06-08 15:45 UTC by Jon Goldberger [MSFT]
Modified: 2016-01-29 12:11 UTC (History)
7 users (show)

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


Attachments
Test Project (5.17 MB, application/zip)
2015-06-08 15:45 UTC, Jon Goldberger [MSFT]
Details
Reduction (1.11 MB, application/x-zip-compressed)
2015-06-09 17:46 UTC, Chris King
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:
RESOLVED ANSWERED

Description Jon Goldberger [MSFT] 2015-06-08 15:45:14 UTC
Created attachment 11524 [details]
Test Project

## Description

Creating a BindableProperty to a property of type "double" causes iOS app to crash on device only. Crash does not occur on iOS Simulator or Android device or simulator. 

## Steps to reproduce

1. Open the attached test project.

2. Launch the project to an iOS device.

Expected result: App will launch and not crash. (There is no UI on the test project, so would just get a black screen)

Actual result: App crashes at startup.

## Stack trace:

 error: * Assertion: should not be reached at ../../../../../mono/mono/mini/../../../mono-extensions/mono/mini/../../../mono-extensions/mono/mini/mini-arm64-gsharedvt.c:272
> critical: Stacktrace:
>
> critical:   at <unknown> <0xffffffff>
> critical:   at Xamarin.Forms.BindableProperty.Create<!!0, !!1> (System.Linq.Expressions.Expression`1<System.Func`2<!!0, !!1>>,!!1,Xamarin.Forms.BindingMode,Xamarin.Forms.BindableProperty/ValidateValueDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangedDelegate`1<!!1>,Xamarin.Forms.BindableProperty/BindingPropertyChangingDelegate`1<!!1>,Xamarin.Forms.BindableProperty/CoerceValueDelegate`1<!!1>,Xamarin.Forms.BindableProperty/CreateDefaultValueDelegate`2<!!0, !!1>) <IL 0x0000e, 0x00157>
> critical:   at (wrapper unknown) object.gsharedvt_in () <0xffffffff>
> critical:   at BindableDoublePropertyBugDemo.BindableFoo`1..cctor () <0x00217>
> critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
> critical:   at <unknown> <0xffffffff>
> in /Users/apple/Downloads/BindableDoublePropertyBugDemo/BindableDoublePropertyBugDemo/AppDelegate.cs:25
> critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
> critical:   at <unknown> <0xffffffff>
>,intptr,intptr) <0xffffffff>
> in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/UIKit/UIApplication.cs:63
> in /Users/builder/data/lanes/1503/e6ebd18b/source/maccore/src/UIKit/UIApplication.cs:46
> in /Users/apple/Downloads/BindableDoublePropertyBugDemo/BindableDoublePropertyBugDemo/Main.cs:12
> critical:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
> critical: 
>Native stacktrace:
>
> critical: 	0   BindableDoublePropertyBugDemo       0x00000001006f3e0c mono_handle_native_sigsegv + 264
> critical: 	1   libsystem_platform.dylib            0x00000001949c495c _sigtramp + 68
> critical: 	2   libsystem_pthread.dylib             0x00000001949cd170 pthread_kill + 112
> critical: 	3   libsystem_c.dylib                   0x00000001948a6b18 abort + 112
> critical: 	4   BindableDoublePropertyBugDemo       0x00000001007b962c log_callback + 76
> critical: 	5   BindableDoublePropertyBugDemo       0x00000001007b02bc monoeg_assertion_message + 96
> critical: 	6   BindableDoublePropertyBugDemo       0x00000001006ef990 mono_arch_get_gsharedvt_call_info + 1388
> critical: 	7   BindableDoublePropertyBugDemo       0x00000001006f5214 mini_get_gsharedvt_wrapper + 236
> critical: 	8   BindableDoublePropertyBugDemo       0x00000001006f76a8 instantiate_info + 2072
> critical: 	9   BindableDoublePropertyBugDemo       0x00000001006f5b18 fill_runtime_generic_context + 468
> critical: 	10  BindableDoublePropertyBugDemo       0x00000001002abc5c generic_trampoline_rgctx_lazy_fetch + 252
> critical: 	11  BindableDoublePropertyBugDemo       0x00000001005ab6c8 Xamarin_Forms_BindableProperty_Create___0___1_System_Linq_Expressions_Expression_1_System_Func_2___0___1___1_Xamarin_Forms_BindingMode_Xamarin_Forms_BindableProperty_ValidateValueDelegate_1___1_Xamarin_Forms_BindableProperty_BindingPropertyChangedDelegate_1___1_Xamarin_Forms_BindableProperty_BindingPropertyChangingDelegate_1___1_Xamarin_Forms_BindableProperty_CoerceValueDelegate_1___1_Xamarin_Forms_BindableProperty_CreateDefaultValueDelegate_2___0___1 + 344
> critical: 	12  BindableDoublePropertyBugDemo       0x00000001002acb6c gsharedvt_trampoline + 220
> critical: 	13  BindableDoublePropertyBugDemo       0x00000001000ac9f8 BindableDoublePropertyBugDemo_BindableFoo_1__cctor + 536
> critical: 	14  BindableDoublePropertyBugDemo       0x000000010027c8f4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 180
> critical: 	15  BindableDoublePropertyBugDemo       0x00000001007003ac mono_jit_runtime_invoke + 1260
> critical: 	16  BindableDoublePropertyBugDemo       0x000000010074fd7c mono_runtime_invoke + 128
> critical: 	17  BindableDoublePropertyBugDemo       0x0000000100750170 mono_runtime_class_init_full + 648
> critical: 	18  BindableDoublePropertyBugDemo       0x00000001006fd854 mono_jit_compile_method_with_opt + 576
> critical: 	19  BindableDoublePropertyBugDemo       0x00000001006fd5c4 mono_jit_compile_method + 56
> critical: 	20  BindableDoublePropertyBugDemo       0x00000001006f9ccc common_call_trampoline + 964
> critical: 	21  BindableDoublePropertyBugDemo       0x00000001002ab6dc generic_trampoline_jit + 252
> critical: 	22  BindableDoublePropertyBugDemo       0x00000001000ac45c BindableDoublePropertyBugDemo_AppDelegate_FinishedLaunching_UIKit_UIApplication_Foundation_NSDictionary + 348
> critical: 	23  BindableDoublePropertyBugDemo       0x000000010027c8f4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 180
> critical: 	24  BindableDoublePropertyBugDemo       0x00000001007003ac mono_jit_runtime_invoke + 1260
> critical: 	25  BindableDoublePropertyBugDemo       0x000000010074fd7c mono_runtime_invoke + 128
> critical: 	26  BindableDoublePropertyBugDemo       0x00000001006c66d4 native_to_managed_trampoline_3 + 640
> + 96
> critical: 	28  UIKit                               0x000000018747f190 <redacted> + 404
> critical: 	29  UIKit                               0x0000000187696854 <redacted> + 2376
> critical: 	30  UIKit                               0x0000000187699208 <redacted> + 1504
> critical: 	31  UIKit                               0x0000000187697778 <redacted> + 184
> critical: 	32  FrontBoardServices                  0x000000018b1dd3c8 <redacted> + 32
> critical: 	33  CoreFoundation                      0x000000018298427c <redacted> + 20
> critical: 	34  CoreFoundation                      0x0000000182983384 <redacted> + 312
> critical: 	35  CoreFoundation                      0x00000001829819a8 <redacted> + 1756
> critical: 	36  CoreFoundation                      0x00000001828ad2d4 CFRunLoopRunSpecific + 396
> critical: 	37  UIKit                               0x000000018747843c <redacted> + 552
> critical: 	38  UIKit                               0x0000000187472fac UIApplicationMain + 1488
> critical: 	39  BindableDoublePropertyBugDemo       0x00000001000fe88c wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 348
> critical: 	40  BindableDoublePropertyBugDemo       0x00000001000cacac UIKit_UIApplication_Main_string___intptr_intptr + 44
> critical: 	41  BindableDoublePropertyBugDemo       0x00000001000cac6c UIKit_UIApplication_Main_string___string_string + 172
> critical: 	42  BindableDoublePropertyBugDemo       0x00000001000ac11c BindableDoublePropertyBugDemo_Application_Main_string__ + 156
> critical: 	43  BindableDoublePropertyBugDemo       0x000000010027c8f4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 180
> critical: 	44  BindableDoublePropertyBugDemo       0x00000001007003ac mono_jit_runtime_invoke + 1260
> critical: 	45  BindableDoublePropertyBugDemo       0x000000010074fd7c mono_runtime_invoke + 128
> critical: 	46  BindableDoublePropertyBugDemo       0x000000010075401c mono_runtime_exec_main + 404
> critical: 	47  BindableDoublePropertyBugDemo       0x00000001007b72b0 xamarin_main + 1844
> critical: 	48  BindableDoublePropertyBugDemo       0x00000001006c7a00 main + 96
> critical: 	49  libdyld.dylib                       0x0000000194816a08 <redacted> + 4
> critical: 
>=================================================================
>Got a SIGABRT while executing native code. This usually indicates
>a fatal error in the mono runtime or one of the native libraries 
>used by your application.
>=================================================================


## Environment

=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Xamarin.Android ===

Version: 5.1.3.1 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3.2 (7718)
Build 6D2105

=== Xamarin.iOS ===

Version: 8.10.1.64 (Business Edition)
Hash: e6ebd18
Branch: master
Build date: 2015-05-21 21:55:09-0400

=== Xamarin.Mac ===

Version: 2.0.1.64 (Business Edition)

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin Jons-iMac.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 3 Jon Goldberger [MSFT] 2015-06-08 21:53:35 UTC
Note: The attached test project was created by Jin-Wook Jung (aka Mark) of TIDCorp.
Comment 5 Stephane Delcroix 2015-06-09 04:52:43 UTC
Looks like an AOT bug with generics.

you can workaround this by defining your BindableProperty like this:

	public static readonly BindableProperty BindableValueProperty = BindableProperty.Create ("BindableValue", typeof(double), typeof(BindableFoo<T>), 0d);

this is a bit more cumbersome, but this is the fastest and actually recommended way of defining BindableProperties.
Comment 6 Chris King 2015-06-09 17:46:30 UTC
Created attachment 11541 [details]
Reduction

We'd be happy to help you resolve this issue. Please help us by attaching a reduced reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue. If you'd do this for us we would very much appreciate it. If you are able to reproduce the issue without modifying the platform specific projects that would eliminate a number of possibilities and likely expedite a resolution. 

The included repro doesn't compile as it references a non-included key. I attempted to reduce the repro in the above suggested fashion and the reduction did not reproduce on my iOS device. 

Warm regards,
Xamarin Forms Team
Comment 7 Jon Goldberger [MSFT] 2015-06-09 18:04:34 UTC
@Chris,

Not sure how much more that that project could be reduced, looks pretty simple to me. I see one line of code added to AppDelegate, and one simple class file added to the project. Reducing it any further would not reproduce the issue. 

To solve the key issue, just change open the Project Options->iOS Bundle Signing settings page and change the Singing Identity and Provisioning Profile to "Automatic" to use your own keys. 

Setting this back top confirmed since Stephane Delcroix seemed to be able to reproduce the issue and offered a "workaround"/better option for creating a binding.
Comment 8 Chris King 2015-06-10 14:09:20 UTC
I'll sync with Stephane. Please disregard.
Comment 9 Rolf Bjarne Kvinge [MSFT] 2015-06-17 03:05:50 UTC
@Zoltan, can you have a look?

The assertion seems to be the same as in bug #29400.
Comment 11 Rolf Bjarne Kvinge [MSFT] 2016-01-29 12:11:14 UTC
This works fine for me using the current stable (Xamarin.iOS 9.4.0.1), so I'm closing this.