Hi all,
Hoping someone can offer some guidance here for me.
My saga is, I have a Xamarin.Mac app and have been working on it for quite some weeks, no issues at all. A few days ago my Visual Studio Mac was completely hung, I killed VS and when I restarted one or two of the source files in the project were empty. That's fine, I restored from source control.
But, ever since then, whenever I run the app inside the Visual Studio IDE I get the above error with stacktrace identical to another Xamarin forums post:
(I can't link to it sorry as this is my first post, the title is the same as my post here)
If I run the app outside of the IDE it works fine.
But wait, there's more. So, reading up a bit it sounded like it might have something to do with latest mono version, with 5.2+ defaulting to 64 bit mode for the first time:
So, in my infinite wisdom I changed the project settings to 32 bit, it kind of runs in the IDE but not really, but it no longer gets that stack trace anymore.
Finally though, even though I have switched the project settings back to 64 bit, whenever I run in the IDE it launches Mono 32 bit with all sorts of strangeness in screen rendering and menu bar.
Thanks for reading this far, here's my lovely stack trace which I see every time.
Argh...
John
WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.CGDisplayBounds (intptr) [0x00009] in <37dfd86a0d3248c0b8cd4af52ec71426>:0
at System.Windows.Forms.XplatUICarbon.get_WorkingArea () [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs:2263
at System.Windows.Forms.XplatUICarbon.get_VirtualScreen () [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs:2257
at System.Windows.Forms.XplatUI.get_VirtualScreen () [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUI.cs:420
at System.Windows.Forms.Screen..cctor () [0x00034] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Screen.cs:53
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001f] in <48b95f3df5804531818f80e28ec60191>:0
at <unknown> <0xffffffff>
at System.Windows.Forms.Hwnd.GetNextStackedFormLocation (System.Windows.Forms.CreateParams,System.Windows.Forms.Hwnd) [0x00064] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Hwnd.cs:836
at System.Windows.Forms.XplatUICarbon.CreateWindow (System.Windows.Forms.CreateParams) [0x000c5] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs:936
at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams) [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUI.cs:514
at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams) [0x00009] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/NativeWindow.cs:165
at System.Windows.Forms.Control.CreateHandle () [0x00031] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs:4215
at System.Windows.Forms.Form.CreateHandle () [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs:1913
at System.Windows.Forms.Control.CreateControl () [0x00039] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs:3529
at System.Windows.Forms.Control.SetVisibleCore (bool) [0x0003a] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs:4770
at System.Windows.Forms.Form.SetVisibleCore (bool) [0x00065] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs:2380
at System.Windows.Forms.Control.set_Visible (bool) [0x00009] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Control.cs:3200
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.set_Visible (bool) [0x00033] in <37dfd86a0d3248c0b8cd4af52ec71426>:0
at System.Windows.Forms.Application.RunLoop (bool,System.Windows.Forms.ApplicationContext) [0x00053] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs:795
at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext) [0x00011] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs:696
at System.Windows.Forms.Application.Run (System.Windows.Forms.Form) [0x00000] in /private/tmp/source-mono-d15-3/bockbuild-d15-3/profiles/mono-mac-xamarin/build-root/mono-x64/mcs/class/System.Windows.Forms/System.Windows.Forms/Application.cs:679
at XTaws.Program.Main () [0x0000b] in /Users/john/Projects/Bitbucket/xtaws2/avionics/Program.cs:19
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0004d] in <48b95f3df5804531818f80e28ec60191>:0
Native stacktrace:
0 mono64 0x0000000103923c91 mono_handle_native_crash + 257
1 mono64 0x0000000103989af6 altstack_handle_and_restore + 70
2 SkyLight 0x00007fffd91317a1 SLDisplayBounds + 68
3 ??? 0x000000010b952a44 0x0 + 4489292356
4 ??? 0x0000000103ef916f 0x0 + 4360999279
5 mono64 0x000000010387a135 mono_jit_runtime_invoke + 2245
6 mono64 0x0000000103a7b948 do_runtime_invoke + 88
7 mono64 0x0000000103a778dd mono_runtime_class_init_full + 1021
8 mono64 0x0000000103873b2a mono_jit_compile_method_inner + 2442
9 mono64 0x000000010387647a mono_jit_compile_method_with_opt + 714
10 mono64 0x000000010392629f common_call_trampoline + 1199
11 mono64 0x0000000103925db9 mono_magic_trampoline + 73
12 ??? 0x0000000103cdb39e 0x0 + 4358779806
13 ??? 0x000000010b951575 0x0 + 4489287029
Debug info from gdb:
(lldb) command source -s 0 '/tmp/mono-gdb-commands.xPw7KW'
Executing commands in '/tmp/mono-gdb-commands.xPw7KW'.
(lldb) process attach --pid 2985
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/libglib-2.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 2985 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00007fffdce253ee libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
-> 0x7fffdce253ee <+10>: jae 0x7fffdce253f8 ; <+20>
0x7fffdce253f0 <+12>: movq %rax, %rdi
0x7fffdce253f3 <+15>: jmp 0x7fffdce1dcd4 ; cerror
0x7fffdce253f8 <+20>: retq
Executable module set to "/Library/Frameworks/Mono.framework/Versions/5.2.0/bin/mono64".
Architecture set to: x86_64-apple-macosx.
(lldb) thread list
Process 2985 stopped
* thread #1: tid = 0x22975, 0x00007fffdce253ee libsystem_kernel.dylib`__wait4 + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
thread #2: tid = 0x22976, 0x00007fffdce24bf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
thread #3: tid = 0x22978, 0x00007fffdce1d386 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
thread #4: tid = 0x22979, 0x00007fffdce2544e libsystem_kernel.dylib`__workq_kernreturn + 10
thread #5: tid = 0x2297a, 0x00007fffdce2544e libsystem_kernel.dylib`__workq_kernreturn + 10
thread #6: tid = 0x2297b, 0x00007fffdce2544e libsystem_kernel.dylib`__workq_kernreturn + 10
thread #7: tid = 0x2297c, 0x00007fffdce24df6 libsystem_kernel.dylib`__recvfrom + 10, name = 'Debugger agent'
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x00007fffdce253ee libsystem_kernel.dylib`__wait4 + 10
frame #1: 0x0000000103923d1d mono64`mono_handle_native_crash(signal="SIGSEGV", ctx=<unavailable>, info=<unavailable>) at mini-exceptions.c:2555 [opt]
frame #2: 0x0000000103989af6 mono64`altstack_handle_and_restore(ctx=0x00007fff5c395540, obj=0x0000000000000000, stack_ovf=0) at exceptions-amd64.c:795 [opt]
frame #3: 0x00007fffd91317a1 SkyLight`SLDisplayBounds + 68
frame #4: 0x000000010b952a44
frame #5: 0x0000000103ef916f
frame #6: 0x000000010387a135 mono64`mono_jit_runtime_invoke(method=<unavailable>, obj=0x0000000000000000, params=<unavailable>, error=<unavailable>) at mini-runtime.c:2549 [opt]
frame #7: 0x0000000103a7b948 mono64`do_runtime_invoke(method=0x00007f84a1853350, obj=0x0000000000000000, params=0x0000000000000000, exc=0x00007fff5c395ec8, error=0x00007fff5c3960c8) at object.c:2829 [opt]
frame #8: 0x0000000103a778dd mono64`mono_runtime_class_init_full [inlined] mono_runtime_try_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=0x00007fff5c3960c8) at object.c:2937 [opt]
frame #9: 0x0000000103a7789c mono64`mono_runtime_class_init_full(vtable=0x00007f84a188ff08, error=0x00007fff5c3960c8) at object.c:471 [opt]
frame #10: 0x0000000103873b2a mono64`mono_jit_compile_method_inner(method=<unavailable>, target_domain=<unavailable>, opt=<unavailable>, error=0x00007fff5c3960c8) at mini.c:4365 [opt]
frame #11: 0x000000010387647a mono64`mono_jit_compile_method_with_opt(method=<unavailable>, opt=<unavailable>, jit_only=0, error=<unavailable>) at mini-runtime.c:1889 [opt]
frame #12: 0x000000010392629f mono64`common_call_trampoline(regs=0x00007fff5c3961a8, code="H\x89\x84$\b\x01", m=<unavailable>, vt=0x0000000000000000, vtable_slot=0x0000000000000000, error=0x00007fff5c3960c8) at mini-trampolines.c:704 [opt]
frame #13: 0x0000000103925db9 mono64`mono_magic_trampoline(regs=<unavailable>, code=<unavailable>, arg=<unavailable>, tramp=<unavailable>) at mini-trampolines.c:834 [opt]
frame #14: 0x0000000103cdb39e