This bug is related to https://bugzilla.xamarin.com/show_bug.cgi?id=34774. The same crash occurs when using the Xamarin distributed 32 bit Mono.framework rather than a custom 64-bit framework as described in bug 34774.
Please see https://github.com/mcneel/mono_embed for a sample to reproduce.
In main.cpp of the sample, replace the MONO_64_PATH string with "/Library/Frameworks/Mono.framework/Versions/Current". Fix EMBED_TEST_PATH. Be sure to change the Xcode mono_embed > Build Settings > Architectures setting to 32-bit Intel.
This sample uses the 32 bit Mono.framework and executes a method written in C#.
The C# method in turn calls two exported C functions (one that takes an int and
a double as parameters and one that takes a string).
On Yosemite / Xcode 6.4 this sample runs with no errors
On El Capitan / Xcode 7.1 this sample crashes when attempting to debug inside of
Xcode. The crash occurs when trying to call the C function with a string
parameter. When the Xcode debugger is NOT attached, this sample also runs with
no problems on El Capitan.
I can reproduce this.
- If I use a brand new mono / master (c765316) 64-bit and the app in 64-bit, everything works great, both debugging and running
- If I swap to my installed system mono (804ddbc) and set the app to 32-bit, everything works when I run from command line but if I debug, I crash with this stack:
I'm going to try a system mono patching the 64-bit version I built to see if that changes behavior.
Trying a173357 (one after c765316, which did not have a build available) gives same behavior.
Could you take a look at this one?
I have also been actively pursuing this problem. I found that a patch from LogosBible
https://github.com/mono/mono/commit/3adcd34f783a870cc07ab8d9c3b2782328b0938f fixes the crash in the test program and in our 64 bit application. That patch is in master, so anything built after Nov 2 would work.
However, we found that our 64 bit application then started crashing *Xcode*. More info here:
http://lists.ximian.com/pipermail/mono-osx/2015-November/005336.html. We do not yet have a simple test case to show this new problem.
If I can duplicate the Xcode crash with a simple test program, I will file it as a new bug and post a reference here.
I cannot duplicate the Xcode crash with simple test programs. Unfortunately, the Xcode crash only happens with our large CAD program.
In searching for work-arounds, I tried duplicating this issue using the Xamarin.Mac frameworks. A Xamarin.Mac test program also crashed when run inside Xcode but did not crash when run from the command line. See https://bugzilla.xamarin.com/show_bug.cgi?id=35948 for details.
*** Bug 34774 has been marked as a duplicate of this bug. ***
I cannot reproduce with Mono 184.108.40.206 (2017-12/dcaf47f5187), please reopen if you still can. Thank you.