Bug 11605 - Stop in exception stops even if no exception is set
Summary: Stop in exception stops even if no exception is set
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-04-05 05:46 UTC by Marek Safar
Modified: 2013-07-31 15:13 UTC (History)
2 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 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 Marek Safar 2013-04-05 05:46:30 UTC
using System;
using System.Threading;
using System.Threading.Tasks;

namespace AsyncExceptions
	class MainClass
		public static void Main (string[] args)
			TestAsync ();
			WaitHandle.WaitAny (new[] { new ManualResetEvent (false) });

		static async void TestAsync ()
			await Task.Delay (500);
			await Task.Factory.StartNew (() => { throw new ApplicationException (); });

Run the code and XS breaks in mscorlib even if break on exception is empty and debug framework code is disabled
Comment 1 Jeffrey Stedfast 2013-04-05 15:43:51 UTC
I'm pretty sure that this is just because that exception is uncaught.
Comment 2 Jeffrey Stedfast 2013-04-05 16:18:42 UTC
doing a bit of debugging, this is because the synchronization context is throwing the exception in a thread-pool thread in AsyncVoidMethodBuilder.cs
Comment 3 Marek Safar 2013-04-05 16:22:52 UTC
I am not sure how this is related. I selected don't stop on exception and XS still stops
Comment 4 Jeffrey Stedfast 2013-04-05 16:25:11 UTC
we *always* stop on uncaught exceptions
Comment 5 Mikayla Hutchinson [MSFT] 2013-04-05 16:52:22 UTC
If an exception is thrown out the top of any thread, it is unhandled and would crash the app, so the debugger stops. That's what's happening here.