Bug 35416 - Crash when pInvoking a C function with a string parameter on El Capitan using Mono.framework
Summary: Crash when pInvoking a C function with a string parameter on El Capitan using...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 34774 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-30 14:58 UTC by Marlin Prowell
Modified: 2018-01-05 15:09 UTC (History)
8 users (show)

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

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 GitHub or Developer Community 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_REPRODUCIBLE

Description Marlin Prowell 2015-10-30 14:58:30 UTC
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.
Comment 1 Chris Hamons 2015-11-10 10:51:45 UTC
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:

https://gist.github.com/chamons/f654f4e2646462627ea9

I'm going to try a system mono patching the 64-bit version I built to see if that changes behavior.
Comment 2 Chris Hamons 2015-11-10 11:25:47 UTC
Trying a173357 (one after c765316, which did not have a build available) gives same behavior.
Comment 3 Rodrigo Kumpera 2015-11-10 11:41:23 UTC
Hi Alex,

Could you take a look at this one?
Comment 4 Marlin Prowell 2015-11-10 11:43:23 UTC
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.
Comment 5 Marlin Prowell 2015-11-10 11:44:39 UTC
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.
Comment 6 Marlin Prowell 2015-11-17 15:03:59 UTC
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.
Comment 8 Ludovic Henry 2018-01-05 14:56:51 UTC
*** Bug 34774 has been marked as a duplicate of this bug. ***
Comment 9 Ludovic Henry 2018-01-05 15:09:26 UTC
I cannot reproduce with Mono 5.10.0.18 (2017-12/dcaf47f5187), please reopen if you still can. Thank you.