title: Can you prevent exceptions on Xamarin.Mac from terminating the app?
body: <p>I know that catching all exceptions in an app is generally bad, but in my WPF app I do:</p>
  
  <pre><code>  Application.Current.DispatcherUnhandledException += (s, e) =&gt; {
      ReportException(e.Exception, false);
      e.Handled = true;
    };
  </code></pre>
  
  <p>This is mostly useful to prevent minor features (like drag&amp;drop) and async code from crashing the app - I log &amp; display the info to the user.</p>
  
  <p>I want to do the same thing in Xamarin.Mac, but there doesn't seem to be an equivalent. I tried:</p>
  
  <pre><code>  AppDomain.CurrentDomain.UnhandledException += (sender, args) =&gt; Log(args.Exception);
    TaskScheduler.UnobservedTaskException += (sender, args) =&gt;
    {
        args.SetObserved();
        Log(args.Exception);
    };
    Runtime.MarshalManagedException += (sender, args) =&gt; Log(args.Exception);
    Runtime.MarshalObjectiveCException += (sender, args) =&gt; Log(args.Exception);
  </code></pre>
  
  <p>But when crashing in an <code>async void</code> method, <code>TaskScheduler.UnobservedTaskException</code>, <code>MarshalManagedException</code> and <code>MarshalObjectiveCException</code> are not called, 
  and <code>AppDomain.Current.UnhandledException</code>'s <code>e.IsTerminating</code> is get-only, so I can't prevent the app from exiting.</p>
  
  <p>For Android there's <code>AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledException;</code></p>
  
  <p>But for Mac there doesn't seem to be a way to cancel the app going down?</p>