<?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>Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx</link><description>Async CTP Refresh - Design Changes 
 The big news about the Async CTP Refresh is that it enabled development on SP1 and for Windows Phone 7, and came with a new EULA. But there were also a few design changes... 
 
 Async is like the zombie virus </description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#10161334</link><pubDate>Thu, 05 May 2011 12:35:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10161334</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;I think there&amp;#39;s a small typo in the first example:&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim i = $temp.GetResult()&lt;/p&gt;
&lt;p&gt;i = Nothing&amp;quot;&lt;/p&gt;
&lt;p&gt;Surely the second line should be &amp;quot;$temp = Nothing&amp;quot;?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10161334" width="1" height="1"&gt;</description></item><item><title>re: Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#10155171</link><pubDate>Mon, 18 Apr 2011 13:37:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10155171</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><description>&lt;p&gt;Alex, that&amp;#39;s a nice idea. But note that &amp;quot;f2&amp;quot; actually will emit a warning (&amp;quot;Warning: this async method lacks awaits. Consider running it on a background thread using await Task.Run, or awaiting the async version of some APIs&amp;quot;)... it didn&amp;#39;t really seem worth optimizing code that generated a warning!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10155171" width="1" height="1"&gt;</description></item><item><title>re: Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#10154975</link><pubDate>Mon, 18 Apr 2011 01:40:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154975</guid><dc:creator>Alex Corrado</dc:creator><description>&lt;p&gt;Lucian, thank you for sharing so many details about the development of the Async CTP. I started my own async method framework before the CTP was first announced, and it has been fascinating to compare your implementation choices with my own. In the example you gave above about the &amp;quot;Costs of async,&amp;quot; you had this method:&lt;/p&gt;
&lt;p&gt;Async Function f2() As Task(Of Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Return 1&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;p&gt;You seem to indicate that the above would still be transformed into a state machine. Why not instead add an implicit conversion between T and a completed Task&amp;lt;T&amp;gt;? Then, only perform the full transformation when the async method actually awaits something. You could save 2 of the extra heap allocs you mentioned.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154975" width="1" height="1"&gt;</description></item><item><title>re: Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#10154735</link><pubDate>Sat, 16 Apr 2011 10:22:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154735</guid><dc:creator>tobi</dc:creator><description>&lt;p&gt;You are right with handlers but what if you wanted to kick of an async &amp;quot;workflow&amp;quot; by starting a void-returning method. An example would be AnimateElement(UIElement e). If the element e was null, I would prefer the exception being thrown right after the call happened so I could track down where the null ref came from. Maybe exceptions could be thrown directly up to the first async-point (because that code will execute sequentially anyway).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154735" width="1" height="1"&gt;</description></item><item><title>re: Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#10154635</link><pubDate>Fri, 15 Apr 2011 21:10:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154635</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><description>&lt;p&gt;Tobi - for &amp;quot;Argument Validation&amp;quot;, let&amp;#39;s look at how a regular event-handler vs an async event handler will work...&lt;/p&gt;
&lt;p&gt;Sub Button1_Click() Handles Button1.Click&lt;/p&gt;
&lt;p&gt; &amp;nbsp; If String.IsNullOrEmpty(TextBox1.Text) Then Throw New Exception(&amp;quot;Please supply TextBox1&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; ...&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;vs&lt;/p&gt;
&lt;p&gt;Async Sub Button1_Click() Handles Button1.Click&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Await TaskEx.Yield()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; If String.IsNullOrEmpty(TextBox1.Text) Then Throw New Exception(&amp;quot;Please supply TextBox1&amp;quot;)&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;In both cases, it&amp;#39;s the winforms message-loop that dispatched the Button1Click.&lt;/p&gt;
&lt;p&gt;In the first case, the exception gets sent to the caller, which in this case is the winforms message-loop.&lt;/p&gt;
&lt;p&gt;In the second case, the exception gets posted to the current synchronization context, which in this case is the winforms message loop.&lt;/p&gt;
&lt;p&gt;So in both cases they end up on the winforms message-loop, and the UI experience is the same.&lt;/p&gt;
&lt;p&gt;As for the debugging experience? We&amp;#39;re still fine-tuning this. But an exception thrown from an async sub will almost certainly count as &amp;quot;unhandled by user code&amp;quot;, giving VS the opportunity to stop right there at the moment it&amp;#39;s thrown.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154635" width="1" height="1"&gt;</description></item><item><title>re: Async CTP Refresh - design changes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#10154618</link><pubDate>Fri, 15 Apr 2011 20:07:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154618</guid><dc:creator>tobi</dc:creator><description>&lt;p&gt;What does the change mean to argument validation? I think it means that those exceptions will not appear directly at the call site but at some other random place, like on the message loop in WinForms. Isn&amp;#39;t that hard to diagnose?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154618" width="1" height="1"&gt;</description></item></channel></rss>