You can step over await

Posted by Alex Davies on Simple Talk See other posts from Simple Talk or by Alex Davies
Published on Sun, 01 Jul 2012 20:43:27 +0000 Indexed on 2012/07/01 21:21 UTC
Read the original article Hit count: 213

Filed under:
|

I’ve just found the coolest feature of VS 2012 by far.

I thought that being able to silence an exception from the “exception was thrown” popup was awesome, and the “reload all” button when a project file changes is amazing, but this is way beyond all of that.

You can step over awaits when you debug your code!! With F10!!!

Ok, so that may not sound such a big deal. You can step over ifs and whiles and no-one is celebrating. But await is different. await actually stops your method, signs up to be notified when a Task is finished,  returns, and resumes your method at some indeterminate point in the future. You could even end up continuing on a completely different thread.

All that happens, and all I have to do is press F10.

I used to have to painstakingly set a breakpoint on the first line of my callback before stepping over any asynchronous method. Even when we started using async, my mouse would instinctively click the margin every time I wanted to go past an await. And the times I was driven insane by my breakpoint getting hit by some other path of execution I don’t care about.

I think this might have been introduced in the VS11 Beta, I’m pretty sure I tried it in the Async CTP in VS2010 and it didn’t work. Now it does! Woop!

© Simple Talk or respective owner

Related posts about Uncategorized

Related posts about async