Bug 12727 - [Device only]For 'Data' iOS sample, on clicking "Basic Vici CoolStorage" option application crashes.
Summary: [Device only]For 'Data' iOS sample, on clicking "Basic Vici CoolStorage" opti...
Alias: None
Product: iOS
Classification: Xamarin
Component: Samples ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 7.2.0 (iOS 7.1)
Assignee: Zoltan Varga
: 12060 13192 ()
Depends on:
Reported: 2013-06-17 15:01 UTC by Saurabh
Modified: 2013-12-12 06:02 UTC (History)
6 users (show)

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

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:

Comment 3 GouriKumari 2013-06-27 17:46:04 UTC
*** Bug 12060 has been marked as a duplicate of this bug. ***
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-06-28 08:03:10 UTC
This looks like a legitimate Xamarin.iOS bug.

The behavior I see is weird though:

* With I get the same exception as in comment #2 (with almost the same stack trace: https://gist.github.com/rolfbjarne/c5d53dac5a6fd8b209f0)
* With I get a stack overflow, but the origin of the stack overflow is the same as the exception in comment #2 (stacktrace is identical until "Vici.CoolStorage.CSList`1[Xamarin.Screens.ViciCoolStorage.Person].Add)")

Note: it also only happens the first time it's executed on device (so I have to delete the app every time to reproduce).
Comment 5 Rolf Bjarne Kvinge [MSFT] 2013-06-28 08:39:49 UTC
So the sample works with if I disable generic value sharing.

Zoltan, can you have a look?
Comment 6 Zoltan Varga 2013-07-01 11:22:27 UTC
I can repro this even when gsharedvt is disabled. It crashes at:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x2fd00fec
0x0099a036 in mono_monitor_try_enter_internal (obj=0x767f680, ms=4294967295, allow_interruption=0) at /Users/vargaz/mt-3.0/monotouch/builds/target7/mono/metadata/../../../../../mono/mono/metadata/monitor.c:523
523		if (G_LIKELY (mon->owner == 0)) {
(gdb) bt
#0  0x0099a036 in mono_monitor_try_enter_internal (obj=0x767f680, ms=4294967295, allow_interruption=0) at /Users/vargaz/mt-3.0/monotouch/builds/target7/mono/metadata/../../../../../mono/mono/metadata/monitor.c:523
#1  0x00999dce in mono_monitor_enter (obj=0x767f680) at /Users/vargaz/mt-3.0/monotouch/builds/target7/mono/metadata/../../../../../mono/mono/metadata/monitor.c:702
#2  0x001a9c6c in wrapper_managed_to_native_System_Threading_Monitor_Enter_object () at Array.cs:168
#3  0x00628ac8 in wrapper_synchronized_Vici_CoolStorage_CSObject_1_add_ObjectDeleted_Vici_CoolStorage_ObjectEventHandler_1_T () at Nullable.cs:105

The app works the second time it is ran, whenever compiled with gsharedvt or not. It seems to hit a different execution path the second time it is ran, maybe it created some database the first time. If it is deleted and re-installed, it fails again.
Comment 7 Zoltan Varga 2013-07-01 11:32:24 UTC
This is a runtime bug.
Comment 8 Zoltan Varga 2013-07-02 15:06:38 UTC
We no longer crash, instead we stop with the usual aot exception:

2013-07-02 21:04:28.738 Example_Data[1868:907] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to JIT compile method '(wrapper synchronized) Vici.CoolStorage.CSObject`1<Xamarin.Screens.ViciCoolStorage.Person>:add_ObjectDeleted (Vici.CoolStorage.ObjectEventHandler`1<Xamarin.Screens.ViciCoolStorage.Person>)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

The problem is that the app is using a synchronized method inside a generic class, which is not supported yet.
Comment 9 Zoltan Varga 2013-07-08 16:32:15 UTC
Fixed in master-3.0 9120daf5f5589f1745d5475c985c58763c923b08.
Comment 10 narayanp 2013-07-12 09:09:40 UTC
Today we have checked this issue with following builds:

X.S 4.0.10
Mono 3.1.1-2

We are still getting the same issue application get crashed after clicking on 'Basic Vici CoolStorage' this is the iOS Device log for the same: https://gist.github.com/atin360/1829d525a4bd5ce0d2e1

Checked it on devices:
iPhone4 version 5.1
iPhone4 version 7.0

Hence reopening this issue.
Comment 12 Rodrigo Kumpera 2013-08-26 17:33:24 UTC
*** Bug 13192 has been marked as a duplicate of this bug. ***
Comment 13 PJ 2013-11-19 16:45:01 UTC
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
Comment 14 PJ 2013-12-02 12:48:02 UTC
Looks like Zoltan says it wasn't fixed in the RC for the july release, but it should have been included for 7.0.4.

Setting to RESOLVED FIXED based on that history, if this is reproducible on 7.0.4 please update and REOPEN.
Comment 15 Atin 2013-12-12 06:02:36 UTC
Today, we have checked this issue with following builds:

XS 4.2.2(build 2)
App info:  monotouch-samples-master 48a09e92a03ccb476b238ec2e793e8f92918ea7d
Device info: iPhone 4s 7.0.4, iPhone 4 7.1

Now we are not getting this issue, application is not crashed after clicking on "Basic Vici CoolStorage" and it should open respective page.

Hence marking this as Verified.