Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I'm getting this stacktrace trying to run Creatures & Castles in the debugger.
I've upgraded to Lion and downloaded the latest xcode from the app store (as of today).
This is using the test build of monotouch available here: http://xamarin.com/priority/monotouch/monotouch-18.104.22.168.dmg
Error connecting stdout and stderr (127.0.0.1:10001)
at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes (System.Reflection.Assembly,bool) <IL 0x0002e, 0xffffffff>
at System.Reflection.Assembly.GetTypes () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:348
at MonoTouch.ObjCRuntime.Runtime.RegisterAssembly (System.Reflection.Assembly) [0x0004b] in /Developer/MonoTouch/Source/monotouch/monotouch/ObjCRuntime/Runtime.cs:83
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
0 CreaturesAndCastles 0x000d0de8 mono_handle_native_sigsegv + 343
1 CreaturesAndCastles 0x0000f74c mono_sigsegv_signal_handler + 322
2 libsystem_c.dylib 0x9c03a59b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 ??? 0x0771cd86 0x0 + 124898694
5 ??? 0x0771cd49 0x0 + 124898633
6 ??? 0x07711f35 0x0 + 124854069
7 ??? 0x077120e5 0x0 + 124854501
8 CreaturesAndCastles 0x0000f507 mono_jit_runtime_invoke + 1332
9 CreaturesAndCastles 0x001ed259 mono_runtime_invoke + 137
10 CreaturesAndCastles 0x0029abc9 monotouch_register + 90
11 CreaturesAndCastles 0x002a1529 main + 3784
12 CreaturesAndCastles 0x00002819 _start + 208
13 CreaturesAndCastles 0x00002748 start + 40
Debug info from gdb:
dyld: could not load inserted library: /Users/andrewrollings/Library/Application Support/iPhone Simulator/4.3.2/Applications/3F4FD1E8-A17F-4D1F-B59D-856D3AB4E02D/CreaturesAndCastles.app/monotouch-fixes.dylib
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.
I just tried the C&C code we have and I wasn't able to reproduce this crash (tried on both an iPad device and iPhone simulator) - on Lion.
OTOH I have seen this crash myself with other code, but I can't remember exactly what the issue was. Can you try changing the linking options for the app to see if that changes anything?
(In reply to comment #1)
> I just tried the C&C code we have and I wasn't able to reproduce this crash
> (tried on both an iPad device and iPhone simulator) - on Lion.
> OTOH I have seen this crash myself with other code, but I can't remember
> exactly what the issue was. Can you try changing the linking options for the
> app to see if that changes anything?
I've tried tweaking linking settings to no avail. What concerns me is that it doesn't immediately crash out on your system when you try and run it in the simulator. That implies that there is something amiss in my installation of monotouch.
Which MT version are you using?
I can reproduce a crash in level 8 both on the simulator and device, but it's a different stack trace and it's definitively unrelated.
The Apple simulator (and that's not Lion-specific) has the weird feature to never delete any file. So new assemblies will get added, others will be updated while the rest will become stale.
I added a workaround in the Xamarin's builds of MonoTouch but it cannot cover every cases - i.e. a stale assembly can still cause a crash.
However if you reset your simulator (from the menu) then every files (and every apps) will be deleted from the simulator. The next time you build your application it will be deployed into a clean/empty directory and should work as expected.
I tried that to no avail. I noticed in the stack trace that the debugger is failing to load a library:
dyld: could not load inserted library:
The stack trace shows it's trying to load something it can't load properly. This is exactly what happens in the simulator issue - but it could happen in other cases too. But it's really strange if this only happens in the simulator...
Could you paste the directory content of /Users/andrewrollings/Library/Application Support/iPhone
Simulator/4.3.2/Applications/3F4FD1E8-A17F-4D1F-B59D-856D3AB4E02D/CreaturesAndCastles.app/ ? filename, sizes and timestamps
As for monotouch-fixes.dylib this warning is normal (and sadly confusing since people only notice it when their application crash) and unrelated to your issue.
-rwxr-xr-x 1 andrewrollings staff 4364248 Aug 4 16:59 CreaturesAndCastles
lrwxr-xr-x 1 andrewrollings staff 140 Aug 9 13:09 CreaturesAndCastles.exe -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/CreaturesAndCastles/bin/iPhoneSimulator/Debug/CreaturesAndCastles.exe
lrwxr-xr-x 1 andrewrollings staff 144 Aug 9 13:09 CreaturesAndCastles.exe.mdb -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/CreaturesAndCastles/bin/iPhoneSimulator/Debug/CreaturesAndCastles.exe.mdb
-rw-r--r-- 1 andrewrollings staff 5089 Aug 3 15:32 Default-Landscape.png
-rw-r--r-- 1 andrewrollings staff 71380 Aug 3 15:32 Default.png
-rw-r--r-- 1 andrewrollings staff 170091 Aug 3 15:32 Default@2x.png
lrwxr-xr-x 1 andrewrollings staff 127 Aug 9 13:09 HiiveGameLib.dll -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/Hiive.GameLib/bin/iPhoneSimulator/Debug/HiiveGameLib.dll
lrwxr-xr-x 1 andrewrollings staff 131 Aug 9 13:09 HiiveGameLib.dll.mdb -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/Hiive.GameLib/bin/iPhoneSimulator/Debug/HiiveGameLib.dll.mdb
lrwxr-xr-x 1 andrewrollings staff 125 Aug 9 13:09 HiiveGameUI.dll -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/Hiive.GameUI/bin/iPhoneSimulator/Debug/HiiveGameUI.dll
lrwxr-xr-x 1 andrewrollings staff 129 Aug 9 13:09 HiiveGameUI.dll.mdb -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/Hiive.GameUI/bin/iPhoneSimulator/Debug/HiiveGameUI.dll.mdb
-rw-r--r-- 1 andrewrollings staff 12450 Aug 4 16:59 Icon-72.png
-rw-r--r-- 1 andrewrollings staff 8098 Aug 4 16:59 Icon-Small-50.png
-rw-r--r-- 1 andrewrollings staff 4838 Aug 4 16:59 Icon-Small.png
-rw-r--r-- 1 andrewrollings staff 9713 Aug 4 16:59 Icon-Small@2x.png
-rw-r--r-- 1 andrewrollings staff 9440 Aug 4 16:59 Icon.png
-rw-r--r-- 1 andrewrollings staff 24037 Aug 4 16:59 Icon@2x.png
-rw-r--r-- 1 andrewrollings staff 2268 Aug 4 16:59 Info.plist
-rw-r--r-- 1 andrewrollings staff 1821 Aug 3 15:32 MainWindow.nib
drwxr-xr-x 6 andrewrollings staff 204 May 26 10:31 Media
lrwxr-xr-x 1 andrewrollings staff 55 Aug 9 13:09 Mono.Security.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll
lrwxr-xr-x 1 andrewrollings staff 59 Aug 9 13:09 Mono.Security.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll.mdb
lrwxr-xr-x 1 andrewrollings staff 114 Aug 4 12:49 MyXNA.dll -> /Users/andrewrollings/Documents/monotouch-projects/CreaturesAndCastles/MyXNA/bin/iPhoneSimulator/Release/MyXNA.dll
lrwxr-xr-x 1 andrewrollings staff 48 Aug 9 13:09 OpenTK.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/OpenTK.dll
lrwxr-xr-x 1 andrewrollings staff 55 Aug 9 13:09 OpenTK.dll.config -> /Developer/MonoTouch/usr/lib/mono/2.1/OpenTK.dll.config
lrwxr-xr-x 1 andrewrollings staff 52 Aug 9 13:09 OpenTK.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/OpenTK.dll.mdb
drwxr-xr-x 3 andrewrollings staff 102 Aug 4 16:59 Settings.bundle
lrwxr-xr-x 1 andrewrollings staff 53 Aug 9 13:09 System.Core.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll
lrwxr-xr-x 1 andrewrollings staff 57 Aug 9 13:09 System.Core.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll.mdb
lrwxr-xr-x 1 andrewrollings staff 61 Aug 9 13:09 System.Web.Services.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/System.Web.Services.dll
lrwxr-xr-x 1 andrewrollings staff 65 Aug 9 13:09 System.Web.Services.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/System.Web.Services.dll.mdb
lrwxr-xr-x 1 andrewrollings staff 52 Aug 9 13:09 System.Xml.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll
lrwxr-xr-x 1 andrewrollings staff 56 Aug 9 13:09 System.Xml.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll.mdb
lrwxr-xr-x 1 andrewrollings staff 48 Aug 9 13:09 System.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/System.dll
lrwxr-xr-x 1 andrewrollings staff 52 Aug 9 13:09 System.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/System.dll.mdb
-rw-r--r-- 1 andrewrollings staff 24037 Aug 3 15:32 icon_114.png
-rw-r--r-- 1 andrewrollings staff 4838 Aug 3 15:32 icon_29.png
-rw-r--r-- 1 andrewrollings staff 8098 Aug 3 15:32 icon_50.png
-rw-r--r-- 1 andrewrollings staff 9440 Aug 3 15:32 icon_57.png
-rw-r--r-- 1 andrewrollings staff 9713 Aug 3 15:32 icon_58.png
-rw-r--r-- 1 andrewrollings staff 12450 Aug 3 15:32 icon_72.png
-rwxr-xr-x 1 andrewrollings staff 8692 Aug 4 16:59 monotouch-fixes.dylib
lrwxr-xr-x 1 andrewrollings staff 51 Aug 9 13:09 monotouch.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll
lrwxr-xr-x 1 andrewrollings staff 55 Aug 9 13:09 monotouch.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll.mdb
lrwxr-xr-x 1 andrewrollings staff 50 Aug 9 13:09 mscorlib.dll -> /Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll
lrwxr-xr-x 1 andrewrollings staff 54 Aug 9 13:09 mscorlib.dll.mdb -> /Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll.mdb
Are you sure you did the "Reset and Content and Settings..." on your iOS Simulator ?
The 'guid'-based directory (from comment #6) should not exists anymore - it should have been destroyed*. Another one (with a new guid) should exists with all files should have identical timestamps.
* at least that's what happens on Snow Leopard (I'll ask someone to confirm the behavior on Lion).
In the above list you have one assembly, MyXNA.dll, which is older by 5 days than the rest of your assemblies.
lrwxr-xr-x 1 andrewrollings staff 114 Aug 4 12:49 MyXNA.dll ->
Sadly we do not (presently) log enough information so I can't be sure this it the 'bad' assembly. If reset-ing again your simulator does not work could you zip up that directory and attach it ?
I manually removed the simulator app directory entirely and rebuilt and it works.
Doing a complete clean/rebuild didn't seem to copy the built stuff into the simulator directory.
Surely this should have been overwritten? No assemblies have been removed from the project.
From your last comment it looks like you did "Clean" and "Rebuild" inside MonoDevelop - which would explain why things did not get re-created like I expected.
Remember that this is a *simulator* bug, not a MonoTouch or MonoDevelop bug . To workaround that issue you must do a "Reset and Content and Settings..." from inside the iOS Simulator application (located in its Apple menu).
What happens is that MD builds the .app (and it will be cleaned properly) and then tells the iOS simulator, please execute /mypath/bin/iPhoneSimulator/Release/myapp.app
Next the simulator *copies* from /mypath/bin/iPhoneSimulator/Debug/myapp.app into /Users/user/Library/Application Support/iPhone
Simulator/4.3.2/Applications/some-guid-decided-by-sim/myapp.app/ and then execute the application from this copied directory.
This is where the *simulator* is buggy since it does not remove files that does not exists anymore (inside the .app that MD generated). So old, stale assemblies could exists in the simulator directory (even if they did not exists inside MD original .app directory). A crash, like yours, occur when the application tries to load such a stale assembly.
 we have some (and will get more) workarounds in MonoTouch (and likely MonoDevelop) but the real issue is not there
Additional info: I didn't mention it in the previous comment, but I did actually perform a reset of the simulator too... Maybe the simulator didn't reset correctly. I did install the new version of xcode in between the reset and the testing, so it's possible something esoteric got screwed up.
It's possible that older/newer simulators behave differently (wrt reset). I was using xcode 3.x when I first found out about it and I know it still occurs with xcode 4. Also I presume it's more related to xcode than the OS since the former is providing the simulator - but there could be some OS specific stuff too.
I'm working on a better workaround for next release of MonoTouch (after 4.1). Hopefully this will _always_ hide the simulator bug from developers, without requiring a reset.
Fixed, only the known to be valid assemblies will be loaded in the simulator.
This will be part of the release after MonoTouch 4.1.