Bug 17712 - TaskScheduler.UnobservedTaskException raised for trapped exceptions
Summary: TaskScheduler.UnobservedTaskException raised for trapped exceptions
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-02-11 17:36 UTC by Jonathan Pryor
Modified: 2014-02-11 17:37 UTC (History)
1 user (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 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:

Description Jonathan Pryor 2014-02-11 17:36:44 UTC
(Looks like Bug #17699 redux!)

Please see test case at: https://bitbucket.org/tpurtell/xa4.12alpha-gc-async-exceptions

The test case loads a URL which doesn't exist within an async method, and handles the method:

    static async Task FailedWebRequest()
      var client = new HttpClient();
        var result = await client.GetStringAsync("");
        Console.WriteLine("Got valid result?: {0}", result);
      catch (Exception e)
          Console.WriteLine("Caught Exception: {0}", e.Message);

Note that any exceptions are handled.

Meanwhile, we subscribe to the TaskScheduler.UnobservedTaskException event. The TaskScheduler.UnobservedTaskException event is still raised, despite the Task being handled.
Comment 2 Jonathan Pryor 2014-02-11 17:37:30 UTC
Should be fixed in: https://github.com/mono/mono/commit/c1539ef0