<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx</link><description>These days it’s not uncommon for me to receive an email or read a forum post from someone concerned about a problem they’re experiencing with an async method they’ve written, and they’re seeking help debugging the issue.&amp;#160; Sometimes plenty of information</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389609</link><pubDate>Wed, 30 Jan 2013 19:19:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389609</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;@Chris Charabaruk: I agree this kind of functionality would be useful, and as mentioned it&amp;#39;s something we&amp;#39;re looking into. &amp;nbsp;It would be difficult to do well in a VS Update, however, as doing this in a robust manner requires the runtime to track more information than it currently does.&lt;/p&gt;
&lt;p&gt;@James Chaldecott: I&amp;#39;m glad you&amp;#39;re enjoying the posts; thanks for the kind words. &amp;nbsp;Regarding a custom awaiter, yes, you could certainly implement one, e.g. its OnCompleted method could add the Task to a ConcurrentDictionary&amp;lt;Task,WhateverStateYouWantedTracked&amp;gt;, and then pass along to the underlying OnCompleted method a delegate that removes the task and invokes the actual continuation, e.g. task.GetAwaiter().OnCompleted(() =&amp;gt; { m_awaitedTasks.TryRemove(task, ...); continuation(); }); &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389609" width="1" height="1"&gt;</description></item><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389431</link><pubDate>Wed, 30 Jan 2013 09:25:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389431</guid><dc:creator>James Chaldecott</dc:creator><description>&lt;p&gt;Thanks for the info, Stephen. At least I know it&amp;#39;s not worth looking for how I might write such an extension, now. I hope it&amp;#39;s something you&amp;#39;ll be able to work on soon.&lt;/p&gt;
&lt;p&gt;I suppose if I *really* wanted something it might be possible to write an extension method a bit like ConfigureAwait that added entries into a list &amp;amp; removed them when the continuation runs (perhaps using CallerFilePath, etc). Does that sound possible?&lt;/p&gt;
&lt;p&gt;Anyway, I also forgot to say what Jerome said: Another excellent post! I really appreciate all the in-depth information you provide in your posts. Thanks! &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389431" width="1" height="1"&gt;</description></item><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389368</link><pubDate>Wed, 30 Jan 2013 04:00:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389368</guid><dc:creator>Chris Charabaruk</dc:creator><description>&lt;p&gt;@Stephen: It&amp;#39;d certainly be handy to add await tracking to the debugger! Given how much of a move there is to working with asynchronous functions in the .NET 4.5 / WinRT age, being able to know the state of those functions is becoming more and more important. I hope that you guys decide to introduce it in VS2012 Update 3 (I figure it&amp;#39;s probably a bit late to get something that big into Update 2 at this point).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389368" width="1" height="1"&gt;</description></item><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389241</link><pubDate>Tue, 29 Jan 2013 17:53:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389241</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;@Damien: Thanks. &amp;nbsp;I&amp;#39;m half surprised any of this even compiles, given that I just typed it directly into the blogging tool ;) I&amp;#39;ve fixed the typo.&lt;/p&gt;
&lt;p&gt;@James: That information isn&amp;#39;t currently tracked in any way that would be easily mineable. &amp;nbsp;We&amp;#39;re thinking about it for the future.&lt;/p&gt;
&lt;p&gt;@Jerome: I&amp;#39;m glad you found it helpful.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389241" width="1" height="1"&gt;</description></item><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389151</link><pubDate>Tue, 29 Jan 2013 14:00:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389151</guid><dc:creator>Jerome</dc:creator><description>&lt;p&gt;An excellent post, as always. I just wished you&amp;#39;d written it months ago. The issue with passing async lambdas around bit me more than once before I realized what I was doing wrong! And it&amp;#39;s not always obvious immediately.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389151" width="1" height="1"&gt;</description></item><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389110</link><pubDate>Tue, 29 Jan 2013 09:53:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389110</guid><dc:creator>James Chaldecott</dc:creator><description>&lt;p&gt;Somewhat related to this&lt;/p&gt;
&lt;p&gt;Is there any way to see in a debugger a list of outstanding awaits? &lt;/p&gt;
&lt;p&gt;If not, would it even be possible to write an add-in or debugger visualizer or something (at least for the common case of looking for outstanding Task continuations)?&lt;/p&gt;
&lt;p&gt;It&amp;#39;s a bit weird in a program with lots of async operations pending that you can hit &amp;quot;pause&amp;quot; in the debugger and have no idea what state the program is actually in. It&amp;#39;s particularly irksome when the async operations are each themselves made up of multiple async operations.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389110" width="1" height="1"&gt;</description></item><item><title>re: Psychic Debugging of Async Methods</title><link>http://blogs.msdn.com/b/pfxteam/archive/2013/01/28/psychic-debugging-of-async-methods.aspx#10389052</link><pubDate>Tue, 29 Jan 2013 06:49:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10389052</guid><dc:creator>Damien</dc:creator><description>&lt;p&gt;There&amp;#39;s a second bug in 3) b) - Reset is locking on a different object than the other methods. So the locking is all broken anyway. (I know it&amp;#39;s not the main theme of this post - but it&amp;#39;s a common problem with locking issues)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10389052" width="1" height="1"&gt;</description></item></channel></rss>