Bug 4011 - iPad 2 application crashes in main() with iOS v5.1
Summary: iPad 2 application crashes in main() with iOS v5.1
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-21 11:45 UTC by Dave Brooks
Modified: 2012-03-22 19:32 UTC (History)
2 users (show)

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


Attachments
iPad crash log (22.29 KB, application/octet-stream)
2012-03-21 11:45 UTC, Dave Brooks
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 NOT_ON_ROADMAP

Description Dave Brooks 2012-03-21 11:45:27 UTC
Created attachment 1550 [details]
iPad crash log

Running Monodevelop v2.8.8.1 Xcode 4.3.1 Monotouch v5.2.10

Using an iPad 2,2 and iOS v5.1 with a Monotouch application embedded into an XCode application. The application is built using archive and as an Ad-Hoc release. 
During running the mono 'main(..)' in 'main.m' it crashes on line 1621 in 'monotouch_init', please see the attached crash log.

Specifically this is what is crashing:-
SnapMobile                    	0x007e47ae monoeg_g_logv (goutput.c:128)
9   SnapMobile                    	0x007e47ea monoeg_g_log (goutput.c:142)
10  SnapMobile                    	0x00743536 mono_resolve_patch_target (mini.c:3164)
11  SnapMobile                    	0x0074bda8 mono_aot_plt_resolve (aot-runtime.c:3164)
12  SnapMobile                    	0x00752180 mono_aot_plt_trampoline (mini-trampolines.c:770)
13  SnapMobile                    	0x0023f310 0x1000 + 2351888
14  SnapMobile                    	0x0020b640 (wrapper runtime-invoke) object:runtime_invoke_dynamic (mscorlib.dll.6.s:151896)
15  SnapMobile                    	0x00744290 mono_jit_runtime_invoke (mini.c:5786)
16  SnapMobile                    	0x007b3d38 mono_runtime_invoke (object.c:2757)
17  SnapMobile                    	0x007378a8 monotouch_init (monotouch-glue.m:692)
18  SnapMobile                    	0x00002f1a monomain (main.m:1621)

Thanks for you help,
Dave
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-03-21 19:25:45 UTC
Embedding a MonoTouch application inside an Xcode application is unfortunately not a supported scenario, so it is unlikely that this issue will ever be fixed.

What you can do though is to call native code (from Xcode) from a MonoTouch application - you could even do all your logic in Xcode and just call your native main method (renamed to something else to not clash with MonoTouch' main method) from MonoTouch.
Comment 2 Dave Brooks 2012-03-22 12:15:54 UTC
Thanks for the update, please note that your documentation on this page:-
   http://iosapi.xamarin.com/?link=man%3amtouch(1)
under the section "--xcode" explains specifically how to do this and says 'typically used when extending an existing Objective-C application', which is what we have done.

To do this we used:-
/Developer/Monotouch/usr/bin/mtouch  -v -sdk="5.1" --targetver="5.0" --device="iPad" --displayname="MyProg" --bundleid="myprog.mycompany"  --xcode="/Users/Dave/Projects/MyProg/bin/Release/output" "/Users/Dave/Projects/MyProg/bin/Release/MyProg.dll" 
This worked on every version up to the latest iOS & mono versions.



I have followed your suggestion and I have downloaded the latest samples "xamarin-monotouch-samples-7bd9a1f" and looked at "BindingSample" - is this the correct place?
This sample does not seem to build with the latest Xcode v4.3.1 and iOS v5.1.  Specifically, there seems to be a problem with 'RunScript.sh'.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2012-03-22 19:32:52 UTC
It is possible that the sample hasn't been updated to work with the most recent Xcode/iOS version (I just tried the sample and it works for me; this is probably because I've had earlier Xcodes/iOS SDKs installed earlier though). Exactly what is the error the script runs into?

Thanks for the info about the man page, I'll update it.