Bug 60063 - Xamarin.Mac exception marshalling is broken
Summary: Xamarin.Mac exception marshalling is broken
Alias: None
Product: Windows iOS Simulator
Classification: Xamarin
Component: Simulator ()
Version: 1.1
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.4 SR1
Assignee: Bugzilla
Depends on:
Reported: 2017-10-09 17:01 UTC by Alan McGovern
Modified: 2017-10-09 17:07 UTC (History)
3 users (show)

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 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:

Description Alan McGovern 2017-10-09 17:01:07 UTC

> Alan McGovern [12:53] 2017-10-05 11:52:49.733 MonoDevelop[46104:4956973] Xamarin.Mac: Could not load mono_set_pending_exception
> Alan McGovern [12:54] any idea why that's crashing my IDE?
> Alan McGovern [12:54] https://gist.github.com/alanmcgovern/b39f921c6cf14ab6f2e78abac2f74c94
> Rolf Kvinge [12:56] let me look
> Rolf Kvinge [12:57] https://github.com/xamarin/ios-sim-sharp/blob/7b7a174d398a3ccd2b82936619b3f74d8baa7e73/MonoTouch.Hosting/Bindings/Library64.cs#L39
> Rolf Kvinge [12:57] it's the `[MarshalNativeExceptions]` attribute
> Alan McGovern [12:58] yeah - we want to marshal native exceptions
> Rolf Kvinge [12:58] XM will catch the native exception, convert it to a managed exception, and call `mono_set_pending_exception`
> Alan McGovern [12:58] as we have for 5-6 years now :stuck_out_tongue:
> Rolf Kvinge [12:58] but `mono_set_pending_exception` is a private symbol, so XM doesn't find it
> Rolf Kvinge [12:58] and then aborts
> Alan McGovern [12:58] why is it private?
> Alan McGovern [12:58] that's an ABI breakage by the sounds of it
> Rolf Kvinge [12:59] it's not public in the headers
> Alan McGovern [12:59] when did it become not-public?
> Rolf Kvinge [12:59] which works as long as you link statically
> Rolf Kvinge [12:59] but it breaks when using the system libmono.dylib
> Alan McGovern [12:59] this is the configuration we've been shipping for years now
> Rolf Kvinge [13:00] it probably broke when I implemented better support for marshalling exceptions

A workaround has been prepared and merged here: https://github.com/xamarin/ios-sim-sharp/pull/287
Comment 1 Alan McGovern 2017-10-09 17:04:32 UTC
Analysis of impact:

The IDE will randomly crash when obj-c code throws exceptions. This meets the criteria for backporting a fix during 'freeze'.