Bug 55870 - marshal-managed-exceptions is not honored in async methods called from obj-c
Summary: marshal-managed-exceptions is not honored in async methods called from obj-c
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Runtime ()
Version: Master
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2017-05-01 20:14 UTC by Chris Hamons
Modified: 2017-05-10 05:26 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 or GitHub 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 Chris Hamons 2017-05-01 20:14:15 UTC
public override void DidFinishLaunching (NSNotification notification) {
            InvokeOnMainThread (() => {
                DoIt ();

        async void DoIt () {
            throw new System.InvalidOperationException ("asdf");

with --marshal-managed-exceptions=abort set does not abort.

However, change:

        async void DoIt () {
        void DoIt () {

and it will.

Here is the bubble up exception that should be aborting: https://gist.github.com/chamons/275be112179e285075adf39e6b1317c6
And here is the abort in the happy working case: https://gist.github.com/chamons/aa15c5afc6dedb0fd724f458ff9c4e0d
Comment 1 Rolf Bjarne Kvinge [MSFT] 2017-05-05 06:19:59 UTC
master: https://github.com/xamarin/xamarin-macios/pull/2064
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-05-10 05:26:33 UTC
fixed (master): https://github.com/xamarin/xamarin-macios/commit/477f5dc5614e166d1b7b3a58609edfc6d9603f90