Bug 3522 - Crash on iPhone Simulator on first interaction due to iPhone using the wrong hardware version, despite settings of minimum SDK
Summary: Crash on iPhone Simulator on first interaction due to iPhone using the wrong ...
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
: 3425 ()
Depends on:
Reported: 2012-02-17 15:17 UTC by Jason Awbrey
Modified: 2012-02-28 20:04 UTC (History)
8 users (show)

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

simple test app with three tabs and view controllers (3.31 KB, application/x-zip-compressed)
2012-02-17 15:17 UTC, Jason Awbrey
build output (1.62 KB, text/plain)
2012-02-17 15:44 UTC, Jason Awbrey

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:

Description Jason Awbrey 2012-02-17 15:17:48 UTC
Created attachment 1375 [details]
simple test app with three tabs and view controllers

MT 5.2.5
Mono 2.10.9
XCode 4.3
OS X 10.7.3
iOS 5.0 SDK

After upgrading to latest XCode and MT, when launching my app in the simulator it renders correctly, but trying to click on any UI element causes a crash.

I created a simple test project (attached) that displays the same behavior.  Clicking on the tab bar after launch causes a crash.


  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000b7>
  at TestApp.Application.Main (string[]) <0x00017>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   TestApp                             0x000908ec mono_handle_native_sigsegv + 284
	1   TestApp                             0x00005c88 mono_sigsegv_signal_handler + 248
	2   libsystem_c.dylib                   0x9763159b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   CoreFoundation                      0x011ae032 -[__NSArrayM getObjects:range:] + 626
	5   CoreFoundation                      0x01158f14 __NSArrayChunkIterate + 308
	6   CoreFoundation                      0x01124665 __NSArrayEnumerate + 997
	7   CoreFoundation                      0x01124056 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 102
	8   UIKit                               0x021c4c43 -[UIView(Geometry) hitTest:withEvent:] + 646
	9   UIKit                               0x024f4fbf -[UIStatusBarWindow hitTest:withEvent:] + 78
	10  UIKit                               0x021bf42d +[UIWindow _hitTestToPoint:pathIndex:forEvent:] + 378
	11  UIKit                               0x02191253 _UIApplicationHandleEvent + 1966
	12  GraphicsServices                    0x0478afa9 PurpleEventCallback + 1274
	13  CoreFoundation                      0x011951c5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
	14  CoreFoundation                      0x010fa022 __CFRunLoopDoSource1 + 146
	15  CoreFoundation                      0x010f890a __CFRunLoopRun + 2218
	16  CoreFoundation                      0x010f7db4 CFRunLoopRunSpecific + 212
	17  CoreFoundation                      0x010f7ccb CFRunLoopRunInMode + 123
	18  GraphicsServices                    0x04789879 GSEventRunModal + 207
	19  GraphicsServices                    0x0478993e GSEventRun + 114
	20  UIKit                               0x02190a9b UIApplicationMain + 1175
	21  ???                                 0x09ff6774 0x0 + 167733108
	22  ???                                 0x09ff5958 0x0 + 167729496
	23  ???                                 0x09ff57f0 0x0 + 167729136
	24  ???                                 0x09ff587f 0x0 + 167729279
	25  TestApp                             0x00009ff2 mono_jit_runtime_invoke + 722
	26  TestApp                             0x00169eee mono_runtime_invoke + 126
	27  TestApp                             0x0016dfd4 mono_runtime_exec_main + 420
	28  TestApp                             0x001733f5 mono_runtime_run_main + 725
	29  TestApp                             0x000671f5 mono_jit_exec + 149
	30  TestApp                             0x002116c9 main + 2825
	31  TestApp                             0x00003045 start + 53

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
Comment 1 Sebastien Pouliot 2012-02-17 15:31:20 UTC
It works for me but my environment is a bit different (someone else will be trying this with an environment closer to yours). 

In the meantime could you attach the full build log (add a few "-v" to the "additional mtouch arguments) used to build your application and the "Application Output" content before the crash too ? Thanks
Comment 2 Jason Awbrey 2012-02-17 15:44:44 UTC
Created attachment 1376 [details]
build output
Comment 3 Jason Awbrey 2012-02-17 15:45:13 UTC
Build output attached.

The only application output is the stack trace.
Comment 4 Sebastien Pouliot 2012-02-17 15:49:52 UTC
weird, don't you see (in light grey, not black) something like:

Starting iOS simulator 5.0
Launching application
Application launched. PID = 68927
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.dll [External]
Thread started: 
Loaded assembly: /Users/poupou/Downloads/testapp/TestApp/bin/iPhoneSimulator/Debug/TestApp.exe
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll [External]
Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll [External]
Comment 5 Jason Awbrey 2012-02-17 15:55:59 UTC
Nope.  I vaguely recall it used to do that, but I'm not seeing it now.
Comment 6 PJ 2012-02-17 16:04:48 UTC
Hey all, I have checked this bug on:

MT 5.2.5
Mono 2.10.9
XCode 4.3
OS X 10.7.3
iOS 5.0 SDK

(exact same environment, as far as these variables are concerned)

I ran the test case in the simulator and on an iPad2 in both Debug and Release.

I found I could switch the tab selector around with no issues each time.

Wish I could have found the issue for ya, but we'll have to do more sleuthing.
Comment 7 Jason Awbrey 2012-02-17 16:08:47 UTC
I installed the MT and Mono updates BEFORE I installed the new XCode.  Could that have any impact?
Comment 8 Sebastien Pouliot 2012-02-17 16:15:36 UTC
Jason, I don't see how... but re-installing should not hurt either (it won't even be "on-top" if it since they are now located in totally different locations).

It's also strange that it does not look like the original report you gave on the mailing-list. Something went wrong somewhere... I hope we'll pinpoint it quickly.
Comment 9 Jason Awbrey 2012-02-17 16:22:17 UTC
What's the best approach to reinstall?  It tried downloading the MT installer from my purchases page, but it didn't appear to do anything (presumably it already detected the install).
Comment 11 Jason Awbrey 2012-02-17 17:41:56 UTC
Reinstalling MT and Mono SDK didn't have any impact.
Comment 12 Miguel de Icaza [MSFT] 2012-02-17 17:48:54 UTC
I have seen this before.

The fix is to make the iPhone simulator default to the iOS 5 SDK.

The only way I have found to change the simulator version is to wait for the simulator crash and then a dialog is shown that offers you to pick a different SDK:

[Swtich SDKs]

And then pick the 5.0 version.

I do not know how to do this programmatically, other than waiting for the crash.
Comment 13 Jason Awbrey 2012-02-17 17:58:42 UTC
Weird...  it is indeed launching the simulator v4.3.2, even though I specified 5.0 in MD.  If I switch it with the Hardware --> Version menu to 5.0 and relaunch, it seems to work.

Now that I've done that, if I kill the simulator and run again, it comes up in 5.0

Thanks, Miguel, Sebastien & company...
Comment 14 Miguel de Icaza [MSFT] 2012-02-17 18:04:52 UTC
Now, if I could only figure out how to programmatically set the SDK to 5.0, we would be all set.
Comment 15 Miguel de Icaza [MSFT] 2012-02-17 18:07:05 UTC
Reopening after changing the subject of the bug.
Comment 16 Rolf Bjarne Kvinge [MSFT] 2012-02-17 19:42:47 UTC
This is strange. I can reproduce this bug by running an app in the simulator from MonoDevelop, and then in the simulator menu choose Hardware -> Version -> 4.3.2 (8H7). The app will be killed. Run the app again (without exiting the simulator) and now it crashes when you touch anything.

The strange part is that the 4.3.2 (8H7) menu entry does not show up if I run the exact same mtouch command as MonoDevelop does from a terminal.
Comment 17 Rolf Bjarne Kvinge [MSFT] 2012-02-20 17:50:56 UTC
This should be fixed now (md-addins: e9ac70a).

The fix will probably be in the next MonoDevelop update. In the meantime there is a workaround in comment #13.
Comment 18 Rolf Bjarne Kvinge [MSFT] 2012-02-20 17:53:48 UTC
*** Bug 3425 has been marked as a duplicate of this bug. ***