Bug 60065 - Make exception marshaling work with system mono
Summary: Make exception marshaling work with system mono
Status: Tracked in Related Links
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Runtime ()
Version: Master
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.8
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2017-10-09 17:11 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2018-07-03 00:59 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 for Bug 60065 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Tracked in Related Links

Description Rolf Bjarne Kvinge [MSFT] 2017-10-09 17:11:47 UTC
[Spinoff from bug #59979, which ended up a confusing mess due to fixes from several teams included - this bug is about the problem in Xamarin.Mac]


> 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

PR in progress which needs to be completed: https://github.com/mono/mono/pull/4654

Workaround to call mono_raise_exception if mono_set_pending_exception isn't available:

master: https://github.com/xamarin/xamarin-macios/pull/2845 
d15-5: https://github.com/xamarin/xamarin-macios/pull/2853
Comment 1 Rolf Bjarne Kvinge [MSFT] 2018-03-22 12:38:19 UTC
New mono PR: https://github.com/mono/mono/pull/7759