Bug 11868 - Step over await call
Summary: Step over await call
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger (show other bugs)
Version: unspecified
Hardware: PC All
: --- enhancement
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2013-04-19 16:17 UTC by João Vitor
Modified: 2017-11-14 05:18 UTC (History)
6 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description João Vitor 2013-04-19 16:17:21 UTC
Step over an await call should send you to the next line (when the async operation is completed), today it sends you to the end of the method.

Internally the method is broken in many steps, as a state machine, but this should not mess with your debug experience.


Obs:
A workaround is to set breakpoints after every await call in the method.
Comment 1 Marek Safar 2013-07-05 03:07:19 UTC
That's correct, the debugger steps on lines which are executed in the flow which in this case is closing }.

I know VS does "magically" switches to another thread with tiny tooltip of "The process or thread has changed since last step" but that's very bad if you want to debug the actual program flow. I think we should do something about the await continuation debugging but don't know what at the moment.
Comment 2 João Vitor 2013-07-05 18:29:08 UTC
I know this is correct, but most of the times you want to debug the current method, line by line.
Today MonoDevelop have the "step over" option, maybe we could have another action, to step line, and that could be the default shortcut.
Comment 3 João Vitor 2013-07-05 18:32:04 UTC
Another solution could be a small pop-up, that showed up when you step over the line. Presenting you the current step over option, and the new option to run to the next line.
Comment 4 David Karlaš 2015-04-20 06:21:08 UTC
Adding test code:

using System;
using System.Threading.Tasks;

namespace asyncTesting
{
	class MainClass
	{
		public static void Main (string [] args)
		{
			var mainClass = new MainClass ();
			mainClass.AsyncMethod ().Wait ();
		}/*Stepping finishes here(after 4 seconds because of .Wait(), otherwise it's "instantly" stops here*/

		private async Task AsyncMethod ()
		{
			await Task.Delay (4000);/*Breakpoint on this line and StepOver*/
			Console.WriteLine ("Test");/*Stepping should finish here after 4 seconds*/
		}
	}
}
Comment 5 David Karlaš 2017-11-14 05:18:37 UTC
https://github.com/mono/mono/pull/4283

Note You need to log in before you can comment on or make changes to this bug.