<?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>Lucian's VBlog</title><link>http://blogs.msdn.com/b/lucian/</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 5.6.583.19199 (Build: 5.6.583.19199)</generator><item><title>Async CTP v3 – installation</title><link>http://blogs.msdn.com/b/lucian/archive/2011/11/01/async-ctp-v3-installation.aspx</link><pubDate>Tue, 01 Nov 2011 00:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10231882</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10231882</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/11/01/async-ctp-v3-installation.aspx#comments</comments><description>&lt;p&gt;The third version of the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/async/"&gt;Async CTP&lt;/a&gt; was released on 31st October 2011.&lt;/p&gt;
&lt;p&gt;The reason for releasing v3 is to address installation issues -- a recent Windows Update had conflicted with the Async CTP v2 and stopped it working, or prevented its installation in the first place. The v3 release also contains one small bugfix, to stop intermittent VB IDE crashes.&lt;/p&gt;
&lt;p&gt;This post is to help with some common installation issues.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;strong&gt;&lt;em&gt;Run Windows Update before installing Async CTP v3, and get all updated (including Optional updates).&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;The Async CTP v3 can be installed over the top of Async CTP v2 (SP1 Refresh): you don&amp;rsquo;t need to uninstall it first.&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Q. Why do we keep releasing updates of the Async CTP? This is the third version so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;October 2010 &amp;ndash; original &lt;strong&gt;Async CTP v1&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;April 2011 &amp;ndash; &lt;strong&gt;Async CTP v2 (SP1 Refresh)&lt;/strong&gt;, to make it compatible with SP1 of VS2010 and fix some bugs&lt;/li&gt;
&lt;li&gt;October 2011 &amp;ndash; &lt;strong&gt;Async CTP v3&lt;/strong&gt;, to make it work with recent product updates&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The reason is that Visual Studio and .NET4 keep being updated. The Async CTP is actually a mini-fork of VS2010. Therefore, each time there&amp;rsquo;s a Windows Update which includes changes to the VB or C# compilers, then the Async CTP gets out of date: the update will break the Async CTP if you have it on your machine, and it&amp;rsquo;ll block the Async CTP from being installed on top of it. So far these conflicting updates have been coming out about once every six months, and so we&amp;rsquo;ve had to re-release the Async CTP every six months.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;span style="color: #ff0000;" color="#ff0000"&gt;&lt;span style="color: #260859;" color="#260859"&gt;A quick check that the Async CTP is working&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="color: #000000;" color="#000000"&gt;If you suspect that something&amp;rsquo;s wrong with your installation of the Async CTP, then please check the version number of these four files. (Please check all four, even if you&amp;rsquo;re not doing C# or VB or Phone development).&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;C:\Windows\Microsoft.Net\Framework\v4.0.30319\&lt;b&gt;csc.exe&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;C:\Windows\Microsoft.Net\Framework\v4.0.30319\&lt;b&gt;vbc.exe&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\&lt;b&gt;msvbide.dll&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;My Documents\Microsoft Visual Studio Async CTP\Samples\&lt;b&gt;AsyncCtpLibrary_Phone.dll&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you see the following version numbers, then the Async CTP Refresh has been correctly installed:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class="MsoNormalTable" style="list-style-type: disc; mso-cellspacing: 0in; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 0in 0in 0in;" cellspacing="0" cellpadding="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes;"&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="96"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;span style="color: #ffffff;" color="#ffffff"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: 10.5pt;" color="#ffffff"&gt;csc.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="102"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;span style="color: #ffffff;" color="#ffffff"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: 10.5pt;" color="#ffffff"&gt;vbc.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="103"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;span style="color: #ffffff;" color="#ffffff"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: 10.5pt;" color="#ffffff"&gt;msvbide.dll&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="156"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;span style="color: #ffffff;" color="#ffffff"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: 10.5pt;" color="#ffffff"&gt;AsyncCTPLibrary_Phone.dll&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1; mso-yfti-lastrow: yes;"&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="96"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 10.5pt;"&gt;Async CTP v3&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 10.5pt;"&gt;4.0.30319.517&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="102"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 10.5pt;"&gt;10.0.30319.517 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="103"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 10.5pt;"&gt;4.0.40219.355&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="156"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 10.5pt;"&gt;1.1.0.0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Q. How to find those version numbers? A. Right-click on each file and choose Properties; the version number is in the "Details" tab.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/3187.async_2D00_refresh_2D00_version_2D00_1.png" /&gt; &lt;img border="0" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/1121.async_2D00_refresh_2D00_version_2D00_2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;If the version numbers are incorrect&lt;/h2&gt;
&lt;p&gt;Here are some other version numbers you might find&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 12pt;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class="MsoNormalTable" style="list-style-type: disc; mso-cellspacing: 0in; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 0in 0in 0in;" cellspacing="0" cellpadding="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes;"&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="96"&gt;&amp;nbsp;&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="100"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;csc.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="95"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;vbc.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="97"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;msvbide.dll&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: black; padding: 0in;" valign="top" width="163"&gt;&lt;span style="color: #ffffff; font-size: x-small;" color="#ffffff" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;span style="color: #ffffff;" color="#ffffff"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;AsyncCTPLibrary_Phone.dll&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;l&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1;"&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="96"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;VS2010&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;4.0.30319.1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="95"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="97"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="163"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;i&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;absent&lt;/span&gt;&lt;/i&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 2;"&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="96"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;Async CTP v1&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;4.0.30319.326&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="95"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.326&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="97"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.326&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="163"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;i&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;absent&lt;/span&gt;&lt;/i&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="96"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;VS2010 SP1&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;4.0.30319.1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="95"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.225 &lt;br /&gt; 10.0.30319.431&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="97"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.40219.1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="163"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;i&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;absent&lt;/span&gt;&lt;/i&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="96"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;strong&gt;Windows Update or &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=3556"&gt;&lt;strong&gt;KB2468871&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="95"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.233 &lt;br /&gt;10.0.30319.450&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="97"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="163"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="96"&gt;&lt;strong&gt;&lt;span style="font-size: x-small;" size="2"&gt;Async CTP v2 &lt;br /&gt;(SP1 Refresh)&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: x-small;" size="2"&gt;4.0.30319.440&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="95"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.440&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="97"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.40219.15&lt;/span&gt;&lt;/td&gt;
&lt;td style="background: #aaaaaa; padding: 0in;" valign="top" width="163"&gt;&lt;span style="font-size: x-small;" size="2"&gt;1.0.0.0&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 4; mso-yfti-lastrow: yes;"&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="96"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;b&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;Async CTP v3 &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="100"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;4.0.30319.517&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="95"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.30319.517&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="97"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;10.0.40219.355&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: yellow; padding: 0in;" valign="top" width="163"&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="font-size: x-small;" size="2"&gt;1.1.0.0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I want to stress this: you should check the version numbers of &lt;b&gt;&lt;i&gt;all four files&lt;/i&gt;&lt;/b&gt;. Even if you think you're not going to use C#, say, you should still check all four files including csc.exe. Any discrepancy in &lt;em&gt;any&lt;/em&gt; of the files will indicate your machine is in an incorrect state.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If Visual Studio crashes upon opening a VB/C# project&lt;/h2&gt;
&lt;p&gt;The issue is that VS2010 SP1 had a bug in NGEN. The Async CTP v3 requires that this bug have already been fixed &amp;ndash; either by having Async CTP v2 already on the machine, or by running Windows Update and getting &lt;em&gt;all&lt;/em&gt; updates including optional ones, or by manually installing &lt;strong&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=3556"&gt;KB2468871&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Alternatively, if you&amp;rsquo;ve already got Async CTP v3 on your machine, you can fix the bug manually: open a Developer Command Prompt, run the following command in it, and have a nice cup of tea and biscuit because it&amp;rsquo;s going to take up to an hour:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #333333; font-family: Consolas;" face="Consolas" color="#333333"&gt;ngen update /force&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Uninstallation&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;To uninstall Async CTP v3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is easy: &lt;strong&gt;Start &amp;gt; ControlPanel &amp;gt; UninstallPrograms &amp;gt; ViewUpdates&lt;/strong&gt;, search for all updates with &amp;ldquo;async&amp;rdquo; in their title, and uninstall all of them. You might see as many as &lt;em&gt;five&lt;/em&gt; different entries that need to be uninstalled.&lt;/p&gt;
&lt;p&gt;TIP: Although uninstall order doesn&amp;rsquo;t matter, it goes easier if you uninstall the &amp;ldquo;Visual Studio Async&amp;rdquo; updates first and the &amp;ldquo;.NET Framework Async&amp;rdquo; updates next. That&amp;rsquo;s because the uninstalling the latter will require a reboot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To uninstall Async CTP v2 (SP1 Refresh)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The uninstall of Async CTP v2 has become broken due to a conflicting Windows Update. If you have v2 on your machine and want to install it, then you actually have to install v3 first.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To uninstall Async CTP v1 (pre-SP1 release)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If anyone still has Async CTP v1 from October 2010: we recommend to &lt;em&gt;uninstall&lt;/em&gt; this prior to installing SP1.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;If you still have problems&lt;/h1&gt;
&lt;p&gt;Please post a request for help in the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/async/threads"&gt;Async Discussion Forums&lt;/a&gt;. We do monitor those forums frequently, and we may be able to help.&lt;/p&gt;
&lt;p&gt;When you ask for help, &lt;em&gt;PLEASE&lt;/em&gt; mention all four version numbers. That will help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10231882" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>A day in the life of compiler bugfixing</title><link>http://blogs.msdn.com/b/lucian/archive/2011/10/17/a-day-in-the-life-of-compiler-bugfixing.aspx</link><pubDate>Mon, 17 Oct 2011 20:31:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10226623</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10226623</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/10/17/a-day-in-the-life-of-compiler-bugfixing.aspx#comments</comments><description>&lt;p&gt;The VB/C# team is hard at work on the Async feature... You might already have download the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/async"&gt;Async CTP&lt;/a&gt; yourself, or tried out async in the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/hh127353"&gt;VS11 Developer Preview&lt;/a&gt;, and you might wonder: &amp;quot;The feature seems complete already -- so what are they still working on?&amp;quot; This post is about an example bug that I dealt with last week.&lt;/p&gt;  &lt;p&gt;Most programmers &lt;em&gt;trust&lt;/em&gt; their compilers. If their program's not behaving right, they think their own code is at fault. Even if they narrow it down to what looks like a compiler bug, they still believe it's their own fault -- maybe they think they misunderstand the language, or aren't using it right. It's a big expectation that we in the compiler team have to live up to.&lt;/p&gt;  &lt;p&gt;Here's one bug I worked on last week. I discovered this bug because, as part of unrelated performance investigations, I tested out using &amp;quot;Await&amp;quot; in &lt;em&gt;every possible position&lt;/em&gt; allowed by the the VB language.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;&lt;span class="kwrd"&gt;Module&lt;/span&gt; Module1
    &lt;span class="kwrd"&gt;Sub&lt;/span&gt; Main()
        f().Wait()
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt;

    &lt;span class="kwrd"&gt;Async Function&lt;/span&gt; f() &lt;span class="kwrd"&gt;As&lt;/span&gt; Task
        &lt;span class="kwrd"&gt;Dim&lt;/span&gt; c &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; C
        &lt;span class="kwrd"&gt;Dim&lt;/span&gt; t = Task.FromResult(c)

        &lt;span class="kwrd"&gt;For&lt;/span&gt; (&lt;span class="kwrd"&gt;Await&lt;/span&gt; t).i = 1 &lt;span class="kwrd"&gt;To&lt;/span&gt; 10
            Console.WriteLine(c.i)
        &lt;span class="kwrd"&gt;Next&lt;/span&gt;

&lt;font style="background-color: rgb(255, 255, 0);"&gt;        &lt;span class="rem"&gt;' WHAT I EXPECT: It should print out the numbers 1 to 10&lt;/span&gt;
        &lt;span class="rem"&gt;' WHAT I GET: it doesn't print out anything at all, and fails PEVerify&lt;/span&gt;&lt;/font&gt;
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Function&lt;/span&gt;

    &lt;span class="kwrd"&gt;Class&lt;/span&gt; C
        &lt;span class="kwrd"&gt;Public&lt;/span&gt; i &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;Integer&lt;/span&gt;
    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Class&lt;/span&gt;
&lt;/font&gt;&lt;font size="1"&gt;&lt;span class="kwrd"&gt;End Module&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;


&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Loop control variables with side-effects&lt;/h3&gt;

&lt;p&gt;It looks weird to have an &lt;em&gt;expression&lt;/em&gt; as the loop control variable. Nevertheless, as a historical legacy, VB allows it -- it stems from the days when the For loop didn't declare its own local variable and so always had to refer to some pre-existing variable. The important question to ask is &lt;em&gt;when&lt;/em&gt; and &lt;em&gt;how often&lt;/em&gt; this expression gets executed. Alas the VB language specification (c:\Program Files (x86)\Microsoft Visual Studio 10.0\VB\Specifications\1033) doesn't say. So let's resort to experiment, by making the expression have some observable side-effects:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; c &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; C
    &lt;span class="kwrd"&gt;Function&lt;/span&gt; test() &lt;span class="kwrd"&gt;As&lt;/span&gt; C
        Console.Write(&lt;span class="str"&gt;&amp;quot;* &amp;quot;&lt;/span&gt;)
        &lt;span class="kwrd"&gt;Return&lt;/span&gt; c
    &lt;span class="kwrd"&gt;End&lt;/span&gt; Function&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;&lt;/font&gt;&lt;/pre&gt;


&lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;    &lt;span class="kwrd"&gt;For&lt;/span&gt; test().i = 1 &lt;span class="kwrd"&gt;To&lt;/span&gt; 2
        Console.Write(c.i &amp;amp; &lt;span class="str"&gt;&amp;quot; &amp;quot;&lt;/span&gt;)
    &lt;span class="kwrd"&gt;Next&lt;/span&gt;
    &lt;span class="rem"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;' WHAT I GET: * 1 * * 2 * *&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="1"&gt;&lt;span class="rem"&gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; min = 1
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; max = 2
    &lt;span class="kwrd"&gt;For&lt;/span&gt; test().i = min &lt;span class="kwrd"&gt;To&lt;/span&gt; max
        Console.Write(c.i &amp;amp; &lt;span class="str"&gt;&amp;quot; &amp;quot;&lt;/span&gt;)
    &lt;span class="kwrd"&gt;Next&lt;/span&gt;
    &lt;span class="rem"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;' WHAT I GET: * * 1 * * 2 * *&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/pre&gt;


&lt;p&gt;This is unexpected! It's unexpected that the compiler executes the expression so many times, and unexpected that the exact number of times varies depending on whether the loop bounds were constants or not.&lt;/p&gt;

&lt;p&gt;Looking at the compiler implementation, what it's doing is at the start of each iteration is it &lt;em&gt;assigns to the loop control variable&lt;/em&gt; and then &lt;em&gt;reads from the loop control variable to check whether to do another iteration&lt;/em&gt;. Both of these tasks involve evaluating the expression. But in the first code snippet, with constants for minimum and maximum, it knows it can skip that check the first time around.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Another strange thing is that the original code used to work fine in the Async CTP, but stopped working in the VS11 Developer Preview. The reason is that the CTP played fast-and-loose with evaluation order. It basically factored out all &amp;quot;Await&amp;quot; expressions from a statement, did them all and assigned the results to temporary variables, and then performed the rest of the statement. This was a quick-and-dirty hack to get the CTP out as soon as possible. But it results in the wrong evaluation order -- for instance, &amp;quot;Console.WriteLine(f() &amp;amp; Await g())&amp;quot; would evaluate g() first, then Await it, then evaluate f().&lt;/p&gt;

&lt;p&gt;The VS11 Developer Preview got correct evaluation order in most cases, but it seems to have missed this edge case of For loops.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Fixing the bug?&lt;/h3&gt;

&lt;p&gt;It looked like it would take me about 5 days to fix this bug -- which is very long, considering that I'd like to be fixing 2 bugs a day. It would take this long because the loop comparison logic is all in the codegen phase of the compiler, well after the &amp;quot;async transformation&amp;quot;. It hardly seemed worth the effort -- no one in their right mind would use this strange corner of the compiler. And VB would probably have been a nicer language if it didn't allow any side effects in its loop control variable expressions.&lt;/p&gt;

&lt;p&gt;We can't just leave the bug unfixed. We'll have to add a new paragraph to the language spec and a new error to the compiler to say &amp;quot;You can't use Await in a loop control expression&amp;quot;.&lt;/p&gt;

&lt;p&gt;The decision to add this new error felt like an easy decision. There was no need to bring it to the &amp;quot;VB-Insiders&amp;quot;, a set of elite users under Non-Disclosure Agreements with whom we discuss ideas. There was no need even to bring it to a regular VB Language Design Meeting. My call (as the VB Language Lead) was that it was sufficient just to send an email around the compiler team. Everyone agreed to just add the error.&lt;/p&gt;

&lt;p&gt;The next step was to finalize the wording of the error message with the User Experience team, who are also in charge of writing MSDN documentation about the language. They have to pick a wording that's similar to the existing error messages, and one that can be translated into different world languages. They settled on this:&lt;/p&gt;

&lt;p&gt;&lt;font color="#333333" face="Consolas"&gt;BC37060: 'Await' cannot be used in a loop control variable expression&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;After this, the VB IDE team asked: should we make a &amp;quot;quick-fix&amp;quot; for this error, i.e. a one-click way to automatically fix the user's code if they wrote this? The answer was &amp;quot;definitely not&amp;quot;.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;There we have it. Bug fixed in half a day, on schedule.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10226623" width="1" height="1"&gt;</description></item><item><title>Talk: What's new in VB10 (VS2010)</title><link>http://blogs.msdn.com/b/lucian/archive/2011/05/25/talk-what-s-new-in-vb10-vs2010.aspx</link><pubDate>Wed, 25 May 2011 16:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10168283</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10168283</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/05/25/talk-what-s-new-in-vb10-vs2010.aspx#comments</comments><description>&lt;h1&gt;Talk: What's new in VB10 (VS2010)&lt;/h1&gt;
&lt;p&gt;This talk details the new VB language features that arrived in VS2010&amp;nbsp;-- &lt;br /&gt;&lt;br /&gt;&lt;em&gt;Implicit Line Continuations&amp;nbsp;- &lt;a href="http://www.unemployedunderscores.com/"&gt;http://www.unemployedunderscores.com/&lt;/a&gt;&lt;br /&gt;Array Literals&lt;br /&gt;Collection Initializers&lt;br /&gt;Auto-implemented Properties&lt;br /&gt;Multi-line Sub lambdas (which I used for Silverlight async)&lt;br /&gt;XML-literals, XML-to-schema, LINQ&amp;nbsp;&lt;/em&gt;[actually this was already in VS2008, but it's so good I repeated it]&lt;em&gt;&lt;br /&gt;Silverlight interop; responding to events&lt;br /&gt;DLR silverlight interop; writing to HTML DOM&lt;br /&gt;No-PIA - embedding Primary Interop Assemblies for Office interop&lt;br /&gt;Co-evolution&lt;/em&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;I gave this talk at PDC09 in L.A. on 2009.11.18&lt;/strong&gt; 
&lt;ul&gt;
&lt;li&gt;I'd just bought an old used convertible, spent two months restoring it, and for its first trip I drove down from Seattle to LA on the coastal road. This was my first ever road trip and&amp;nbsp;it was fantastic! Neal Gafter put me up one night at his place San Jose, but apart from that I slept rough in a pile of leaves by the roadside each night and cooked dinner in a billy-can. I got to PDC on the morning the conference started, completely dishevelled.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/PDC/PDC09/FT32"&gt;Watch the talk&lt;/a&gt; online&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/6746.VB10-new-features-_5B00_code_5D00_-_2D00_-Lucian-Wischik-_2D00_-2009.11-PDC_2C00_LA.zip"&gt;source_code.zip&lt;/a&gt; [95k, requires VS2010]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/2330.VB10-new-features-_5B00_script_5D00_-_2D00_-Lucian-Wischik-_2D00_-2009.11-PDC_2C00_LA.txt"&gt;script.txt&lt;/a&gt; [8k]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/1362.VB10-new-features-_5B00_slides_5D00_-_2D00_-Lucian-Wischik-_2D00_-2009.11-PDC_2C00_LA.ppt"&gt;slides.ppt&lt;/a&gt; [1.8mb] - actually these are completely useless: it was a code-only talk.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Similar material elsewhere&lt;/strong&gt; 
&lt;ul&gt;
&lt;li&gt;Interview with me and Lisa Feigenbaum&amp;nbsp;- &lt;a href="http://channel9.msdn.com/blogs/dan/lucian-wischik-and-lisa-feigenbaum-whats-new-in-visual-basic-10"&gt;watch the interview "What's new in VB10"&lt;/a&gt; online on Channel9&lt;/li&gt;
&lt;li&gt;Article by Jonathan Aneja - &lt;a href="http://msdn.microsoft.com/en-us/magazine/ee336123.aspx"&gt;read article "What's new in VB10"&lt;/a&gt; online at MSDN&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/0068.PDC09a.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/0068.PDC09a.jpg" border="0" style="max-height: 267px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/5342.PDC09b.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/5342.PDC09b.jpg" border="0" style="max-height: 267px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/6837.PDC09c.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/6837.PDC09c.jpg" border="0" style="max-height: 267px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/7418.PDC09d.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/7418.PDC09d.jpg" border="0" style="max-height: 300px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/7026.PDC09e.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkNewInVB10/7026.PDC09e.jpg" border="0" style="max-height: 300px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10168283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/talk/">talk</category></item><item><title>Talk: How to write an [Async] connected app for Windows Phone 7.1</title><link>http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-how-to-write-an-async-connected-app-for-windows-phone-7.aspx</link><pubDate>Fri, 20 May 2011 22:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10166861</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10166861</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-how-to-write-an-async-connected-app-for-windows-phone-7.aspx#comments</comments><description>&lt;h1&gt;Talk: How to write an [Async] connected app for Windows Phone 7.1&lt;/h1&gt;
&lt;p&gt;This talk is&amp;nbsp;all about writing a &lt;em&gt;connected app&lt;/em&gt; for the Windows Phone. The talk covered:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(1) Azure/WP7 toolkit &lt;/strong&gt;for the server-side of the phone app. Most good phone apps will need some kind of server-side component, be it for live tile updates or just to form a social community.&lt;br /&gt;&lt;strong&gt;(2) XNA&lt;/strong&gt; for the phone app itself (a Breakout clone) using the new Mango (7.1) phone tools,&amp;nbsp;&lt;br /&gt;&lt;strong&gt;(3) Async language feature&lt;/strong&gt; which makes it &lt;em&gt;much&lt;/em&gt; easier to program how the app communicates with the server -- in this case to download high-score table.&lt;/p&gt;
&lt;p&gt;The material here is in VB, but it all works equally well with C#.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;I gave a VB-specific version of this talk at TechEd 2010 in Atlanta, Georgia on 2011.06.18&lt;/strong&gt; 
&lt;ul&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/3582.How-to-write-a-connected-Phone-app-_5B00_slides_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.06.18-TechEd2011_2C00_-Atlanta_2C00_-USA.pptx"&gt;slides.pptx&lt;/a&gt; [4.8mb]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/7888.How-to-write-a-connected-Phone-app-_5B00_script_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.06.18-TechEd2011_2C00_-Atlanta_2C00_-USA.docx"&gt;script.docx&lt;/a&gt; [27k]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/2570.How-to-write-a-connected-Phone-app-_5B00_code_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.06.18-TechEd2011_2C00_-Atlanta_2C00_-USA.zip"&gt;source_code.zip&lt;/a&gt; [115k], requires VS2010+SP1+&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=77586864-ab15-40e1-bc38-713a95a56a05&amp;amp;displaylang=en"&gt;WindowsPhone7.1&lt;/a&gt;+&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4738205d-5682-47bf-b62e-641f6441735b&amp;amp;displaylang=en"&gt;AsyncCTP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Session &lt;a href="http://northamerica.msteched.com/topic/details/DEV317"&gt;page online&lt;/a&gt;. Alas they haven't put up a video of it yet.&lt;/li&gt;
&lt;li&gt;To encourage people to give feedback, I donate to charity for each session eval submitted.&amp;nbsp;In all&amp;nbsp;22 were submitted and so on May 24th the charity "Doctors Without Borders" got $220, half from me, half from Microsoft. Thank you Atlanta!&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sri Narayanan and I gave a C#-and-VB version of this talk at VSLive2011 in Vegas on 2011.04.19&lt;/strong&gt; 
&lt;ul&gt;
&lt;li&gt;The talk covered exactly the same material as above.&lt;/li&gt;
&lt;li&gt;The audience in Vegas filled out 14 evals and so on May 20th 2011 the charity "Doctors Without Borders" got $140, half from me, half from Microsoft. That's the kind of win I like to see at Vegas!&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/2553.atlanta1.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/2553.atlanta1.jpg" border="0" style="max-height: 225px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/5280.atlanta2.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/5280.atlanta2.jpg" border="0" style="max-height: 225px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/7750.atlanta3.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/7750.atlanta3.jpg" border="0" style="max-height: 225px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/0081.atlanta4.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-TalkConnectedPhoneApp/0081.atlanta4.jpg" border="0" style="max-height: 225px; max-width: 400px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10166861" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category><category domain="http://blogs.msdn.com/b/lucian/archive/tags/talk/">talk</category><category domain="http://blogs.msdn.com/b/lucian/archive/tags/phone/">phone</category></item><item><title>Talk: The [Async] Future of VB and C#</title><link>http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-the-future-of-vb-and-c.aspx</link><pubDate>Fri, 20 May 2011 18:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10166815</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10166815</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-the-future-of-vb-and-c.aspx#comments</comments><description>&lt;h1&gt;Talk: The [Async] Future of VB and C#&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;I gave a C#-specific version of this talk at DevConnections in Las Vegas, USA on 2011.11.01&lt;/strong&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;This talk is mainly about &lt;strong&gt;Async&lt;/strong&gt; and goes into considerable technical depth. It also covers the new&lt;strong&gt; CallerInfo &lt;/strong&gt;feature, and includes a &lt;strong&gt;Roslyn&lt;/strong&gt; demo.&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/8272.Future-of-C_2300_-and-VB-_5B00_slides_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.11.01-DevConnections_2C00_-Vegas_2C00_-USA.pptx"&gt;slides.pptx&lt;/a&gt; [3mb]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/8371.Future-of-C_2300_-and-VB-_5B00_script_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.11.01-DevConnections_2C00_-Vegas_2C00_-USA.docx"&gt;script.docx&lt;/a&gt; [29k]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/7608.Future-of-C_2300_-and-VB-_5B00_code_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.11.01-DevConnections_2C00_-Vegas_2C00_-USA.zip"&gt;source_code.zip&lt;/a&gt; [42k, requires VS2010 SP1 and Async CTP v3 and Phone Developer Tools]&lt;/li&gt;
&lt;li&gt;To encourage people to give feedback, I donate to charity for each session eval submitted. I'm&amp;nbsp;looking forward to see how many evals the DevConnections audience&amp;nbsp;hand in.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;strong&gt;I gave this talk at TechDays11 in Basel, Switzerland on 2011.05.02&lt;/strong&gt;.
&lt;ul&gt;
&lt;li&gt;This talk is mainly about &lt;strong&gt;Async&lt;/strong&gt;, with a little about &lt;strong&gt;Roslyn&lt;/strong&gt;. At PDC 2010, Anders Hejlsberg delivered talk &lt;a href="http://channel9.msdn.com/Events/PDC/PDC10/FT09"&gt;FT09&lt;/a&gt; on the same topics&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Series/TechDays-11-Switzerland/TechDays-11-Basel-The-Future-of-C-and-Visual-Basic"&gt;Watch the talk&lt;/a&gt; online&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/6406.Future-of-C_2300_-and-VB-_5B00_slides_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.05.02-Techdays11_2C00_-Basel_2C00_-Switzerland.pptx"&gt;slides.pptx&lt;/a&gt; [6.3mb]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/0726.Future-of-C_2300_-and-VB-_5B00_script_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.05.02-Techdays11_2C00_-Basel_2C00_-Switzerland.docx"&gt;script.docx&lt;/a&gt; [22k]&lt;/li&gt;
&lt;li&gt;Download&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/3750.Future-of-C_2300_-and-VB-_5B00_code_5D00_-_2D00_-Lucian-Wischik-_2D00_-2011.05.02-Techdays11_2C00_-Basel_2C00_-Switzerland.zip"&gt;source_code.zip&lt;/a&gt; [16k, requires VS2010 SP1 and Async CTP]&lt;/li&gt;
&lt;li&gt;The audience at Basel filled out 89 evals and so on May 20th 2011 the charity "Medecins Sans Frontiers" got $890 half from me and half from Microsoft. Thank you, Basel!&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;I gave a VB-specific version of this talk at TechEd Europe 2010 in Berlin, Germany on 2010.11.11&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;This VB-specific&amp;nbsp;talk&amp;nbsp;covered &lt;strong&gt;Iterators in VB&lt;/strong&gt;, and &lt;strong&gt;VB Support for Windows Phone 7&lt;/strong&gt;, as well as &lt;strong&gt;Async&lt;/strong&gt;&amp;nbsp;above. (The presentation of Async above was better than what I did here...)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/TechEd/Europe/2010/DEV315"&gt;Watch the talk&lt;/a&gt; online&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/4846.2010.11.11-_2D00_-Berlin-_2D00_-Future-of-VB-_5B00_DEV315_5D00_-_2D00_-lucian-wischik.pptx"&gt;slides.pptx&lt;/a&gt; [8mb]&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/4431.2010.11.11-_2D00_-Berlin-_2D00_-Future-of-VB-_5B00_DEV315_5D00_-_2D00_-iterator-samples.zip"&gt;source_code.zip&lt;/a&gt; for iterators [3k, requires VS2010 SP1 and Async CTP]&lt;/li&gt;
&lt;li&gt;The audience in Berlin filled out 29 evals and so on on November 11th 2010 the charity "Medecins Sans Frontiers" got $290 half from me and half from Microsoft. Thank you, Berlin!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/5707.basel1.jpg"&gt;&lt;img style="max-height: 300px; max-width: 400px;" border="0" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/5707.basel1.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/4743.basel2.jpg"&gt;&lt;img style="max-height: 300px; max-width: 400px;" border="0" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/4743.basel2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/3225.basel3.jpg"&gt;&lt;img style="max-height: 300px; max-width: 400px;" border="0" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/3225.basel3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/0511.basel4.jpg"&gt;&lt;img style="max-height: 300px; max-width: 400px;" border="0" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-06-AsyncFutureOfVBCSharp/0511.basel4.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10166815" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category><category domain="http://blogs.msdn.com/b/lucian/archive/tags/talk/">talk</category><category domain="http://blogs.msdn.com/b/lucian/archive/tags/iterators/">iterators</category></item><item><title>[placeholder] How to write a connected VB phone app</title><link>http://blogs.msdn.com/b/lucian/archive/2011/05/18/how-to-write-a-connected-vb-phone-app.aspx</link><pubDate>Wed, 18 May 2011 12:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10165795</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10165795</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/05/18/how-to-write-a-connected-vb-phone-app.aspx#comments</comments><description>&lt;p&gt;This blog&amp;nbsp;article has been moved and enhanced:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-how-to-write-an-async-connected-app-for-windows-phone-7.aspx"&gt;http://blogs.msdn.com/b/lucian/archive/2011/05/20/talk-how-to-write-an-async-connected-app-for-windows-phone-7.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10165795" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Async CTP Refresh - mitigation strategies</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/18/async-ctp-refresh-mitigation-strategies.aspx</link><pubDate>Mon, 18 Apr 2011 14:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10155180</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10155180</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/04/18/async-ctp-refresh-mitigation-strategies.aspx#comments</comments><description>&lt;h1&gt;Async CTP Refresh - mitigations when using the CTP&lt;/h1&gt;
&lt;p&gt;&amp;nbsp;The preceding four blog posts have outlined the known and unknown bug areas in the CTP. Now it's time to set out some concrete mitigation strategies.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Use F# instead&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;F# already shipped in VS2010 with Async support. It is tried, tested, high-quality, supported, and flexible. With F# you can go ahead writing Async code without even worrying about the CTP. F# is also a great language to learn in its own right.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Run PEVerify.exe and unit tests&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Running PEVerify has caught about half of the codegen bugs we've found. You should definitely use it too.&lt;/p&gt;
&lt;p&gt;Hint: quickly launch the "VS Command Prompt (2010)" from the start menu by typing the word "Command" in the search box and picking it from the results.&lt;/p&gt;
&lt;p&gt;And as always, run unit tests. Most of the codegen bugs show up quite clearly even with superficial unit testing. The key bugs we found which didn't (especially the race-condition bugs) have been fixed in the CTP Refresh.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/5557.start.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/4162.command.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Be careful of synchronization context in async Windows Phone apps&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;There's a known issue on Windows Phone 7 such that any Await statements will always resume on the UI thread - even if you performed the Await on a background thread. In the CTP, the "AsyncBackgroundThread" sample shows a work-around for this issue.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Avoid complicated nested awaits&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A "nested await" is an await expression that occurs as a sub-expression of another expression. A good rule of thumb is this: "If I &lt;i&gt;couldn't&lt;/i&gt; easily have rewritten my statement by pulling out all &lt;i&gt;awaits&lt;/i&gt; onto the preceding line, then the Async CTP might not have done it right either." For instance&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;// OK: SIMPLE OPERATORS IN VB+C#:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;var&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt; s = &lt;span style="color: blue;"&gt;await&lt;/span&gt; f() &amp;amp;&amp;amp; &lt;span style="color: blue;"&gt;await&lt;/span&gt; g();&lt;br /&gt;&lt;span style="color: green;"&gt;// is probably safe (albeit wrong order), since it can be trusted to behave like this:&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; $temp1 = &lt;span style="color: blue;"&gt;await&lt;/span&gt; f();&lt;br /&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; $temp2 = &lt;span style="color: blue;"&gt;await&lt;/span&gt; g();&lt;br /&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; s = $temp1 &amp;amp;&amp;amp; $temp2;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;' OK: USING CLAUSES IN VB+C#:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Using&lt;/span&gt; x = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; g() : ... : &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Using&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;' is probably safe, since it can be trusted to behave like this:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; $temp1 = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; g()&lt;br /&gt;&lt;span style="color: blue;"&gt;Using&lt;/span&gt; x = $temp1 : ... : &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Using&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;' USE WITH CARE, AND VERIFY+TEST: LOOPS IN VB:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;While&lt;/span&gt; &lt;span style="color: blue;"&gt;Await&lt;/span&gt; g() : ... : &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;While&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;' Note that it must have been more complicated than just a simple rewrite:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; $temp = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; g()&lt;br /&gt;&lt;span style="color: blue;"&gt;While&lt;/span&gt; temp : ... : &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;While&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;// DANGER: OTHER COMPLICATED IDIOMS IN VB+C#:&lt;/span&gt;&lt;br /&gt;f(&lt;span style="color: blue;"&gt;await&lt;/span&gt; g()).StructField.x = f(&lt;span style="color: blue;"&gt;await&lt;/span&gt; g()).m(&lt;span style="color: blue;"&gt;ref&lt;/span&gt; y, &lt;span style="color: blue;"&gt;await&lt;/span&gt; t);&lt;br /&gt;&lt;span style="color: green;"&gt;// Distrust this kind of code!&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;// * Avoid "await" on the left hand side of an assignment&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;// * Avoid combining awaits with ByRef arguments&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;// * Avoid invoking methods on expressions involving awaits&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;// * Avoid "await" inside array or object initializers&lt;/span&gt;&lt;br style="mso-special-character: line-break;" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Miscellaneous&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Be careful of For loops in VB, and also Select Case statements. Unit-test them thoroughly and PEVerify.&lt;/p&gt;
&lt;p&gt;In particular, non-constant "Steps" in For statements don't work. Thanks to MattMc3 for &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/async/thread/10df3b37-4e52-4d36-bd13-15776c3e8587"&gt;reporting this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10155180" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Async CTP Refresh - what bugs remain in it?</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/17/async-ctp-refresh-what-bugs-remain-in-it.aspx</link><pubDate>Sun, 17 Apr 2011 21:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154955</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10154955</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/04/17/async-ctp-refresh-what-bugs-remain-in-it.aspx#comments</comments><description>&lt;h1&gt;Async CTP Refresh - what bugs remain in it?&lt;/h1&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q. How many bugs remain in the Async CTP Refresh?&lt;/p&gt;
&lt;p&gt;A. That's hard to know. Our QA efforts have been dedicated to testing our async codebase that will be part of the next Visual Studio. We've spent far less time testing the CTP. There might be bugs in the CTP that were never visible in the real codebase. There might be (there &lt;i&gt;were&lt;/i&gt;)&lt;i&gt; &lt;/i&gt;bugs in the real codebase that never impacted the CTP.&lt;/p&gt;
&lt;p&gt;The best I can do is give you an indication of the asyncs compiler bugs we've found, and which aspects of the async feature they're associated with. From this you'll get an idea of which code patterns might be more exposed to bugs.&lt;/p&gt;
&lt;p&gt;Here's an overview of the &lt;i&gt;all&lt;/i&gt; the async bugs we've logged. The green ones have been fixed in the original Async CTP or in the CTP Refresh. All the rest have remain unaddressed in the CTP Refresh.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/4113.pie1.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Bad codegen bugs&lt;/h2&gt;
&lt;p&gt;The red segment of the pie chart is where our main codebase has, at some stage in development, produced bad codegen for certain async coding patterns, and hasn't been fixed in the CTP Refresh, and isn't in one of the main "unsupported-for-CTP" areas.&lt;/p&gt;
&lt;p&gt;All the bugs we've seen in the red category stem from &lt;i&gt;nested awaits&lt;/i&gt;. A 'nested await' is one that appears as a sub-expression of a larger expression. For instance,&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;var&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; x = &lt;span style="color: blue;"&gt;await&lt;/span&gt; f() + &lt;span style="color: blue;"&gt;await&lt;/span&gt; g();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The CTP uses an incorrect order of evaluation for nested awaits. In particular, &lt;i&gt;the CTP will first evaluate all Awaits in a given statement in order; once it has evaluated them all, then it will evaluate the remainder of the expression&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;For the final version of async, which will be shipped in the next Visual Studio, we had to make a major overhaul of the codegen for nested awaits to fix the order of evaluation.&lt;/p&gt;
&lt;p&gt;All of the bugs in this red category were associated in some way either with the CTP's treatment of nested awaits, or with the overhaul of them. Even some code patterns that don't use nested awaits (such as VB "Continue" out of a "Do / Loop Until") suffer bugs that come from the CTP's incorrect order of evaluation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' BUG: VB-only&amp;nbsp;bad behavior in async/iterator methods even without nested awaits.&lt;br /&gt;' SUGGESTION: use PEVerify and run unit-tests&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Do&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If&lt;/span&gt; &lt;span style="color: blue;"&gt;True&lt;/span&gt; &lt;span style="color: blue;"&gt;Then&lt;/span&gt; &lt;span style="color: blue;"&gt;Continue Do&lt;br /&gt;Loop&lt;/span&gt; &lt;span style="color: blue;"&gt;Until&lt;/span&gt; &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; i = 1&lt;br /&gt;&lt;span style="color: blue;"&gt;For&lt;/span&gt; i = 0 &lt;span style="color: blue;"&gt;To&lt;/span&gt; 100&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(i)&lt;br /&gt;&lt;span style="color: blue;"&gt;Next&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' BUG: VB-only&amp;nbsp;For loops don't work if you have non-constant "steps"&lt;br /&gt;' SUGGESTION: Rewrite non-constant Steps into While loops.&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;span style="color: #008000;"&gt;' (Actually, this is the only bug that's not related to nested awaits...)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;nbsp;s = -1&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;For&lt;/span&gt;&lt;span style="color: #000000;"&gt; i =&amp;nbsp;10 &lt;/span&gt;&lt;span style="color: blue;"&gt;To&lt;/span&gt;&lt;span style="color: #000000;"&gt; 1&amp;nbsp;&lt;span style="color: blue;"&gt;Step&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;nbsp;s&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;Yield &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;i&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;Next&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;br /&gt;// BUG: VB and C# bugs calling MyBase in async method (especially with generic params)&lt;br /&gt;// SUGGESTION: use PEVerify to catch these&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;base&lt;/span&gt;.Foo&amp;lt;T&amp;gt;();&lt;br /&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;br /&gt;' BUG: Nested awaits cause VB-only incorrect behavior in flow-control-constructs&lt;br /&gt;' SUGGESTION: Avoid nested awaits in these conditionals&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;Do&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"a"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;Loop&lt;/span&gt; &lt;span style="color: blue;"&gt;Until&lt;/span&gt; &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f()&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;br /&gt;Do&lt;/span&gt; &lt;span style="color: blue;"&gt;While&lt;/span&gt; &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f()&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"a"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;Loop&lt;br /&gt;&lt;br /&gt;If&lt;/span&gt; 11 = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f(10) &lt;span style="color: blue;"&gt;Then&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"a"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;ElseIf&lt;/span&gt; 10 = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f(10) &lt;span style="color: blue;"&gt;Then&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"b"&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;If&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;For&lt;/span&gt; i = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f(1) &lt;span style="color: blue;"&gt;To&lt;/span&gt; &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f(2) &lt;span style="color: blue;"&gt;Step&lt;/span&gt; &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f(3)&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(i)&lt;br /&gt;&lt;span style="color: blue;"&gt;Next&lt;/span&gt;&lt;br /&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;br /&gt;' BUG: Nested awaits are dodgy in both VB and C# in these situations&lt;br /&gt;' SUGGESTION: use PEVerify and unit tests to check you&amp;rsquo;re getting right behavior&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; x = &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: blue;"&gt;With&lt;/span&gt; {.A = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f(1)}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; c2 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt;[] {&lt;span style="color: blue;"&gt;await&lt;/span&gt; f(1), &lt;span style="color: blue;"&gt;await&lt;/span&gt; f(2) };&lt;br /&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; s = (&lt;span style="color: blue;"&gt;Await&lt;/span&gt; f()) &amp;amp; &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f()&lt;br /&gt;&lt;br /&gt;h(&lt;span style="color: blue;"&gt;await&lt;/span&gt; f(1));&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;// when passed to a &amp;ldquo;ParamArray&amp;rdquo; parameter of h()&lt;/span&gt;&lt;br style="mso-special-character: line-break;" /&gt;&lt;br style="mso-special-character: line-break;" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Bugs in language/IDE areas unsupported by the CTP&lt;/h2&gt;
&lt;p&gt;The lower segment of the above pie chart was about areas that are just not supported by the CTP. Here are those areas in detail. They're mostly easy to avoid.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/2117.pie2.png" border="0" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Contextual keywords&lt;/b&gt; - the final implementation of Async will treat "async/await" as contextual keywords in C#, and "Async/Await/Iterator/Yield" as contextual keywords in VB. We have had many bugs in this area, but none of them should affect the CTP - since they are all simply reserved words in the CTP.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Overload resolution&lt;/b&gt; - the final implementation of Async has a host of new rules for overload resolution and type inference. This was a difficult area to implement and test, and none of the changes have been back-ported to the CTP. When you pass an async or iterator lambda as an argument to a method, the CTP will usually fail to do the correct type inference, and will usually fail to pick the correct overload.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Late-bound await&lt;/b&gt; - the final implementation of Async will allow late-bound await, i.e. "Await Object" in VB and "await dynamic" in C#. We had a fair number of bugs in this area. The CTP simply gives an error on these cases, so bypassing all the bugs.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Await in unsafe code&lt;/b&gt; - the final implementation of Async will allow async methods to have unsafe code blocks, just so long as await is never itself in an unsafe context. None of this has been back-ported or tested in the CTP. You should avoid mixing await/async with unsafe in the CTP.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Await in expression lambdas&lt;/b&gt; - the final implementation of Async will allow expression lambdas. The CTP doesn't.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;IDE niceties&lt;/b&gt; - the final implementation of Async will have proper intellisense, quick-fixes, GenerateFromUsage, GoToDefinition and so on. None of these are present in the CTP.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Debugger&lt;/b&gt; - the final implementation of Async will have debugger support. It is absent in the CTP.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nicer error messages&lt;/b&gt; - We filed many bugs and made lots of effort to improve the quality of error messages for erroneous uses of await. None of this work has been back-ported to the CTP, which remains stuck with rather poor error messages.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Bugs in illegal code&lt;/b&gt; - There are many places where the CTP compiler has not yet been hardened against erroneous uses of await. The good news is that if your code is correct, then you won't run into any of these bugs! The bad news is that you may inadvertently write erroneous code, and get VS crashes or PEVerify failures or incorrect codegen. Here are some of the erroneous code that triggers these bugs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;incorrect implementation of the awaiter pattern, or one with constraints&lt;/li&gt;
&lt;li&gt;multiple or missing references to AsyncCtpLibrary.dll&lt;/li&gt;
&lt;li&gt;async constructors or async Main&lt;/li&gt;
&lt;li&gt;ByRef parameters in async/iterator methods&lt;/li&gt;
&lt;li&gt;On Error Goto or Resume in async methods&lt;/li&gt;
&lt;li&gt;async methods with __refvalue or __argiterator params&lt;/li&gt;
&lt;li&gt;await of restricted types such as argiterator/typereference&lt;/li&gt;
&lt;li&gt;use of await in attribute arguments&lt;/li&gt;
&lt;li&gt;use of yield/await in catch/finally blocks&lt;/li&gt;
&lt;li&gt;Also, devious-but-not-illegal implementation of the await pattern may trigger bugs:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' BUG: VB and C#, awaitable pattern with partial/conditional/obsolete pattern methods&lt;br /&gt;' SUGGESTION: implement the pattern straightforwardly&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; t &lt;span style="color: blue;"&gt;As&lt;/span&gt; MyAwaitable&lt;br /&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; t&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Miscellaneous bugs and workitems&lt;/h2&gt;
&lt;p&gt;Here are the rest of the bugs and workitems. None of these affect the quality of code you produce using the Async CTP.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/7701.pie3.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;The few IDE crashes were nebulous and not reproducible. If you run into any, &lt;i&gt;please&lt;/i&gt; let us know! The only ones we've been able to pin down were all reported too late to be fixed in the CTP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VB: Trying to do a late-bound await in a VBCore project&lt;/li&gt;
&lt;li&gt;VB: Making a task-returning async event handler&lt;/li&gt;
&lt;li&gt;C#: hovering over a named indexer that is awaited and then invoked in one expression&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154955" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Async CTP Refresh - compiler bug fixes</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/16/async-ctp-refresh-compiler-bug-fixes.aspx</link><pubDate>Sat, 16 Apr 2011 17:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154803</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10154803</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/04/16/async-ctp-refresh-compiler-bug-fixes.aspx#comments</comments><description>&lt;h1&gt;Async CTP Refresh - Compiler Bug fixes &lt;/h1&gt;
&lt;p&gt;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 bug fixes...&lt;/p&gt;
&lt;p&gt;&lt;i&gt;We heard about some of these bugs from community feedback. Thank you. Such feedback is &lt;b&gt;enormously&lt;/b&gt; useful to us.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;This blog post lists the only compiler bugs fixed in the Async CTP Refresh. (In addition there were several library bugs fixed in the dataflow libraries). I want to spell out in detail some of these bugs we've found and fixed. This will give you an idea of how deeply we looked, and the kinds of bugs that arose. I also want to publically thank the users who alerted us to two of these bugs.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Fixed bug: a C# race condition in "finally" blocks&lt;/h2&gt;
&lt;p&gt;This bug was found by our QA department, and also by a user who emailed us directly, and also by the author of this blog: &lt;a href="http://fredrikeriksson.me/post/3276445803/a-subtle-race-condition-in-the-asyncctp"&gt;http://fredrikeriksson.me/post/3276445803/a-subtle-race-condition-in-the-asyncctp&lt;/a&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// Bug: in the first CTP, if you had high concurrency, then sometimes the finally&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// block would not be executed, and sometimes it would be executed more than once&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;try&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; { &lt;span style="color: blue;"&gt;await&lt;/span&gt; e; }&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;finally&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; { &lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"f"&lt;/span&gt;); }&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="319" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// The first CTP generated this:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;br /&gt;class&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: #2b91af;"&gt;StateMachine&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; color: blue; mso-highlight: yellow;"&gt;bool&lt;/span&gt;&lt;span style="background: yellow; mso-highlight: yellow;"&gt; $doFinallyBodies&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt; MoveNext() {&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$doFinallyBodies = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;try&lt;/span&gt; {&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; $temp = e.GetAwaiter();&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$doFinallyBodies = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (temp.BeginAwait(&lt;i style="mso-bidi-font-style: normal;"&gt;cont&lt;/i&gt;))&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i style="mso-bidi-font-style: normal;"&gt;cont&lt;/i&gt;:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$doFinallyBodies = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$temp.EndAwait();&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;finally&lt;/span&gt; {&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; ($doFinallyBodies) {&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"f"&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="319" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// The CTP Refresh generates this:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;class&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: #2b91af;"&gt;StateMachine&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt; MoveNext() {&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; color: blue; mso-highlight: yellow;"&gt;bool&lt;/span&gt;&lt;span style="background: yellow; mso-highlight: yellow;"&gt; $doFinallyBodies&lt;/span&gt; = &lt;span style="color: blue;"&gt;true&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;...&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The field "$doFinallyBodies" is used so that, if we had to return early due to an "await" statement, then we'd bypass the finally bodies that the user had written. They should only be executed on normal exit.&lt;/p&gt;
&lt;p&gt;The bug was that by accident I'd made $doFinallyBodies&lt;i&gt; &lt;/i&gt;a field. It should have been a local. As a field, if there was high concurrency and lots of threads running the same async method, then one thread might overwrite the shared $doFinallyBodies at the wrong time.&lt;/p&gt;
&lt;p&gt;VB did not have this bug, since in VB it was already a local.&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Fixed bug: another C#/VB race condition in "finally" blocks&lt;/h2&gt;
&lt;p&gt;This bug was found by user "Soonts" on StackOverflow, &lt;a href="http://stackoverflow.com/questions/5032784/async-ctp-and-finally"&gt;http://stackoverflow.com/questions/5032784/async-ctp-and-finally&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Bug: in the first CTP, this would print "1" then "finally".&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' But it's supposed to print "finally" then "1".&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Sub&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; Main()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(f().Result)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; f() &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Task&lt;/span&gt;(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;TaskEx&lt;/span&gt;.Yield()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Return&lt;/span&gt; 1&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Finally&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"finally"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="319" valign="top"&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' The first CTP generated this:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;StateMachine&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Dim&lt;/span&gt; $builder &lt;span style="color: blue;"&gt;As&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AsyncTaskMethodBuilder&lt;/span&gt;(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Sub&lt;/span&gt; MoveNext()&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;TaskEx&lt;/span&gt;.Yield()&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$builder.SetResult(1)&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$builder.SetException(ex)&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Try&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="319" valign="top"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' The CTP Refresh generates this:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;StateMachine&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; $builder &lt;span style="color: blue;"&gt;As&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af;"&gt;AsyncTaskMethodBuilder&lt;/span&gt;(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Sub&lt;/span&gt; MoveNext()&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; &lt;span style="background: yellow; mso-highlight: yellow;"&gt;$ReturnVariable&lt;/span&gt; &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; TaskEx.Yield()&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; mso-highlight: yellow;"&gt;$ReturnVariable = 1&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; color: blue; mso-highlight: yellow;"&gt;GoTo&lt;/span&gt;&lt;span style="background: yellow; mso-highlight: yellow;"&gt; exit&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue;"&gt;As&lt;/span&gt; Exception&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$builder.SetException(ex)&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; color: blue; mso-highlight: yellow;"&gt;Return&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; mso-highlight: yellow;"&gt;exit:&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$builder.SetResult(ReturnVariable)&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Fixed bug: a VB compiler bug with caught exception variables&lt;/h2&gt;
&lt;p&gt;Use of the exception variable would often have failed PEVerify, and in code like below where you're using the exception variable it would have caused a runtime exception. The root cause was that VB compiler generates IL with a temporary local variable for "ex". In an async method, the temporary local variable had to be lifted into the state machine.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Bug: in the first CTP,&amp;nbsp;runtime crashes in some uses of the caught exception variable.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' This has been fixed in the CTP Refresh&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; f()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"test"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; lambda = &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(ex) &lt;span style="color: green;"&gt;' crash right here&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;lambda()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Try&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;h2&gt;Fixed bug: a VB compiler bug with Select statements in asyncs/iterators&lt;/h2&gt;
&lt;p&gt;Select Case statements in VB async+iterator methods had a chance of incorrect codegen, depending on the exact types used by the statement and the ranges of the Case clauses. It sometimes failed PEVerify, and more often just picked the wrong Case branch. Once again the problem was one of IL with temporary local variables, this time for the Select Case operand. This bug was hard to track down because VB does aggressive optimization on Select Case statements, and only certain optimizations would expose the bug.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Bug: in the first CTP, if invoked with "10", this would print ERROR&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' This has been fixed in the CTP refresh&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; f(y &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Long&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Select&lt;/span&gt; &lt;span style="color: blue;"&gt;Case&lt;/span&gt; y&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Case&lt;/span&gt; 8 &lt;span style="color: blue;"&gt;To&lt;/span&gt; 10&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"SUCCESS"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Case Else&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"ERROR"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Select&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;h2&gt;Fixed bug: a VB compiler bug with late-bound For loops in async/iterators&lt;/h2&gt;
&lt;p&gt;Late-bound VB For loops in VB async+iterator methods would often have failed PEVerify and crashed at runtime. Once again the problem was one of IL with temporary local variables, this time for the upper bound of the For loop, and the fix was to lift it to be a field in the state machine. You might get the feeling that a lot of our bugs were due to the need to lift temporary local variables. Once we twigged onto this, we systematically tracked down every last case that needed it.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Bug: in the first CTP, late-bound For loop crashed&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' This has been fixed in the CTP Refresh&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; f()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; x &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Object&lt;/span&gt; = 4&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;For&lt;/span&gt; i = 1 &lt;span style="color: blue;"&gt;To&lt;/span&gt; x&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(i)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Next&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;Note: on the Async Forums, user MattMc3 pointed&amp;nbsp;out a &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/async/thread/10df3b37-4e52-4d36-bd13-15776c3e8587?prof=required"&gt;For loop bug that still exists&lt;/a&gt;: if the&amp;nbsp;For loop has a Step that isn't constant, then it won't work. The reason is that (sigh) the CTP fails to lift the "step variable temporary".&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;h2&gt;Fixed bug: a VB compiler bug with type constraints in asyncs/iterators&lt;/h2&gt;
&lt;p&gt;Generic constraints in async/iterator methods would have caused problems if they referred to other generic parameters of the async method. This usually manifest as a VS crash; sometimes it failed PEVerify instead. The bug was because, when we lift the method into a state machine class, we have to turn the method's generic parameters into generic parameters of the state machine class, and we have to remember to rewrite the constraints accordingly.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Bug: in the first CTP, this could would sometimes crash the IDE.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' This has been fixed in the CTP Refresh&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; CreateListElement(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; TElem, TList &lt;span style="color: blue;"&gt;As&lt;/span&gt; {&lt;span style="color: blue;"&gt;New&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;TElem&lt;/span&gt;)})()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; l2 &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;TList&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;h2&gt;Fixed bug: a pre-existing C# bug with nullables&lt;/h2&gt;
&lt;p&gt;In C#, a method with nullable equality tests would sometimes evaluate the operands more than once. We seemed to hit this more in our async testing, but we discovered that it was caused by a pre-existing bug in VS2010, one that arose from optimizations in the handling of nullables. This has been fixed in the CTP Refresh.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// Bug: in the first CTP, this would do incorrect codegen&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; g() {&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Task&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt;&amp;gt; t = &lt;span style="color: blue;"&gt;null&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt; b = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Nullable&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt;&amp;gt;(&lt;span style="color: blue;"&gt;true&lt;/span&gt;) == &lt;span style="color: blue;"&gt;await&lt;/span&gt; t;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// Bug: in VS2010, this would print "f" twice.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// This has been fixed in the CTP Refresh&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;void&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; Test() {&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt; b = (&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Nullable&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt;&amp;gt;(&lt;span style="color: blue;"&gt;true&lt;/span&gt;)) == f();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(b);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;bool&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; f() {&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"f"&lt;/span&gt;); &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;h2&gt;Fixed bug: a pre-existing C# bug using "base.property"&lt;/h2&gt;
&lt;p&gt;In C#, an async method which accessed "base.property" would cause incorrect codegen in the case where that property had different accessibility of its getter and setter. We discovered that this was caused by a pre-existing bug in VS2010, to do with the similar case of iterators. It would produce incorrect codegen, fail PEVerify, and sometimes throw an exception at runtime. The root cause of the bug is that both iterator and async methods must be lifted into a class. This class can no longer call any protected "base" method since it lacks accessibility. Instead it needs to generate a stub method which does have that accessibility. And the logic for deciding when that stub method was needed, failed to take into account the potential different visibility of setters and getters.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// Bug: in the first CTP, both "f" and "g" would produce bad codegen&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// that failed PEVerify. This has been fixed in the CTP Refresh.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;class&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: #2b91af;"&gt;C&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;B&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;IEnumerator&lt;/span&gt; f() { &lt;span style="color: blue;"&gt;base&lt;/span&gt;.p = 1; &lt;span style="color: blue;"&gt;yield&lt;/span&gt; &lt;span style="color: blue;"&gt;break&lt;/span&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;async&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; g() { &lt;span style="color: blue;"&gt;base&lt;/span&gt;.p = 1; }&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;class&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: #2b91af;"&gt;B&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;virtual&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; p { &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;h2&gt;Fixed bug: VB would sometimes crash VS if you double-dotted&lt;/h2&gt;
&lt;p&gt;In the first CTP, in VB, if you had a variable whose type was inferred from an expression involving Await, and if you then double-dotted off this variable, it would crash VS.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Dim&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; s = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; (&lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WebClient&lt;/span&gt;).DownloadStringTaskAsync(&lt;span style="color: #a31515;"&gt;&lt;a href="http://a.com"&gt;http://a.com&lt;/a&gt;&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Dim&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; len = &lt;span style="color: #2b91af;"&gt;s&lt;/span&gt;.ToUpper().Length &lt;span style="color: green;"&gt;' would crash VS in the first CTP&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;The reasons are pretty bizarre. When you dot off something, the intellisense engine needs to know the type. It finds the type by "keyhole analysis", i.e. only looking at the lines in question, without regard to the containing method. Indeed it didn't know that the containing method was async. There was a mismatch between intellisense (who therefore thought the Await was illegal) and the compiler (who knew it was legal). This mismatch caused the crash. The fix is for intellisense not to judge legality or otherwise of an Await.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154803" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><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><pubDate>Fri, 15 Apr 2011 15:44:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10154525</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10154525</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx#comments</comments><description>&lt;h1&gt;Async CTP Refresh - Design Changes&lt;/h1&gt;
&lt;p&gt;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...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Async is like the zombie virus&lt;/h2&gt;
&lt;p&gt;I've come to believe that async will be like the "zombie virus" - once it bites one part of your program, you'll be inclined make more of your program async just in case an operation takes time. But normally your async methods will complete immediately -- and we've made some design changes to help the performance of this &lt;i&gt;"fast path"&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Design change: new "await" pattern for greater efficiency&lt;/h2&gt;
&lt;p&gt;In the Async CTP Refresh, we changed the "await" pattern to make the fast path more efficient. This will affect anyone who made their own types awaitable. The following code is in VB, but it applies equally to C#.&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' What pattern does the compiler use to implement an await expression?&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;Dim&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt; i = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; e&lt;/span&gt;&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="319" valign="top"&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; mso-layout-grid-align: none;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Old pattern, in first Async CTP&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;&lt;br /&gt;Dim&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; $temp = e.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;GetAwaiter&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;SAVE_STATE()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;If&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; $temp.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;BeginAwait&lt;/span&gt;(&lt;span style="color: blue;"&gt;AddressOf&lt;/span&gt; &lt;i style="mso-bidi-font-style: normal;"&gt;cont&lt;/i&gt;) &lt;span style="color: blue;"&gt;Then&lt;br /&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Return&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End If&lt;br /&gt;&lt;/span&gt;&lt;i style="mso-bidi-font-style: normal;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;cont&lt;/span&gt;&lt;/i&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;RESTORE_STATE()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;Dim&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt; i = $temp.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;EndAwait&lt;/span&gt;()&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="319" valign="top"&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; mso-layout-grid-align: none;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' New pattern, in Async CTP Refresh&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Dim&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; $temp = e.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;GetAwaiter&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;If&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Not&lt;/span&gt; $temp.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;IsCompleted&lt;/span&gt; &lt;span style="color: blue;"&gt;Then&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SAVE_STATE()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$temp.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;OnCompleted&lt;/span&gt;(&lt;span style="color: blue;"&gt;AddressOf&lt;/span&gt; &lt;i style="mso-bidi-font-style: normal;"&gt;cont&lt;/i&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Return&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i style="mso-bidi-font-style: normal;"&gt;cont&lt;/i&gt;:&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;RESTORE_STATE()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;If&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;Dim&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt; i = $temp.&lt;span style="background: yellow; mso-highlight: yellow;"&gt;GetResult&lt;/span&gt;()&lt;br /&gt;i = &lt;span style="color: blue;"&gt;Nothing&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;In the old pattern, it incurred the cost of SAVE_STATE() even if the task had already completed. We couldn't put SAVE_STATE() inside the "Then" clause, because of the off chance that &lt;i&gt;cont&lt;/i&gt; might be executed even before the "Then" clause had executed. In the new pattern we separated it out, so SAVE_STATE() and RESTORE_STATE() are never even executed in the "fast path".&lt;/p&gt;
&lt;p&gt;In the old pattern, it also incurred the cost of constructing a delegate (which I've written "&lt;i&gt;Addressof &amp;lt;label&amp;gt;&lt;/i&gt;" in the pseudo-code above), even if it wasn't needed. The new pattern will allow us to allocate that delegate lazily, potentially saving a heap allocation in the fast path. However, this is just potential for the future: we don't actually take advantage of it.&lt;/p&gt;
&lt;p&gt;In the old pattern, it also left the "awaiter" field hanging around. In the new pattern, we null it out -- the C# equivalent is "default(T)". This is so that the awaiter does not hold onto references for longer than necessary, which could harm garbage collection.&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1" class="MsoTableGrid" style="border-collapse: collapse; background: #ffffcc; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt;"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes;"&gt;
&lt;td width="638" valign="top" style="padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 6.65in; padding-right: 5.4pt; padding-top: 0in; mso-border-alt: solid windowtext .5pt; border: windowtext 1pt solid;"&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;GUIDANCE&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;If you are concerned about garbage collection in a long-running async method, you can &amp;ldquo;null out&amp;rdquo; your local variables. This is the same as what you can currently do in long-running non-async methods.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Taking advantage of async "fast path"&lt;/h2&gt;
&lt;p&gt;How might you take advantage of the async fast path? Here's some sample code, this time in C#. It uses the new method &lt;span style="color: #0000ff;"&gt;TaskEx&lt;/span&gt;.FromResult&amp;lt;T&amp;gt;() which was added in the CTP Refresh.&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// This will use the "fast path" in the common case where the&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// data is already available locally. It will avoid heap allocations&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;// in that case.&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: #2b91af; font-size: 9.5pt;"&gt;Database&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; db;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;while&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; (&lt;span style="color: blue;"&gt;await&lt;/span&gt; db.MoveNextAsync())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(db.Current);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;Thanks to the change, this "while" loop incurs only two small method calls (and no heap allocations) beyond what would be needed in a non-async alternative. The performance boost comes down to this implementation:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;class&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: #2b91af;"&gt;Database&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Task&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt;&amp;gt; trueTask = &lt;span style="color: #2b91af;"&gt;TaskEx&lt;/span&gt;.FromResult(&lt;span style="color: blue;"&gt;true&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt;[] currentBuffer = &lt;span style="color: blue;"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; currentIndex = -1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Current {&lt;span style="color: blue;"&gt;get&lt;/span&gt; {&lt;span style="color: blue;"&gt;return&lt;/span&gt; currentBuffer[currentIndex];}}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Task&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt;&amp;gt; MoveNextAsync()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (currentBuffer != &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; currentIndex &amp;lt; currentBuffer.Length-1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;currentIndex++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="background: yellow; color: blue; mso-highlight: yellow;"&gt;return&lt;/span&gt;&lt;span style="background: yellow; mso-highlight: yellow;"&gt; trueTask;&lt;/span&gt; &lt;span style="color: green;"&gt;// avoids the cost of allocating a task&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; MoveNextAsyncInternal();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;async&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Task&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;bool&lt;/span&gt;&amp;gt; MoveNextAsyncInternal()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;currentBuffer = DownloadNextChunkFromDatabase();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (currentBuffer == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;currentIndex = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Costs of async... where even the "fast path" doesn't help&lt;/h2&gt;
&lt;p&gt;Even if the fast paths are taken everywhere, there are still some inherent costs in async:&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Compare the cost of these two statements.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' The async one has some overhead...&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Dim&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; i1 = f1()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Dim&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; i2 = &lt;span style="color: blue;"&gt;Await&lt;/span&gt; f2()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Function&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; f1() &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Return&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; f2() &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Task&lt;/span&gt;(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Return&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The async call costs THREE extra heap allocations - one for the async state machine, one for its continuation delegate, and one for the resultant Task object.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The async call costs several extra method calls to set up those objects and those fields.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The async call costs additional IL instructions and an additional try/catch block within the body of the method.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The return statement in the async case costs an additional method call.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;To await f2() costs two extra method calls.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So how is it that the previous code managed to avoid most of those costs?&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;while&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt; (&lt;span style="color: blue;"&gt;await&lt;/span&gt; db.MoveNextAsync()) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(db.Current);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here "MoveNextAsync()" was not actually an async method, i.e. it didn't use the async modifier. And it returned a pre-allocated Task object instead of allocating a new one each time. In this way it bypasses most of the extra async costs. The only extra cost it incurs over and above the synchronous case is two extra method calls.&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1" class="MsoTableGrid" style="border-collapse: collapse; background: #ffffcc; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt;"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes;"&gt;
&lt;td width="638" valign="top" style="padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 6.65in; padding-right: 5.4pt; padding-top: 0in; mso-border-alt: solid windowtext .5pt; border: windowtext 1pt solid;"&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;GUIDANCE&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Create &amp;ldquo;chunky async&amp;rdquo; APIs rather than &amp;ldquo;fine-grained async&amp;rdquo; APIs. For instance, create APIs which asynchronously retrieve a batch of rows from the database in one call, rather than just one row at a time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;The extra cost of async is negligible compared to the latency of network operations or UI operations. It is only ever worth thinking about in inner-loops or in server code where you&amp;rsquo;re optimizing for scalability. As always, measure performance before optimizing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Don&amp;rsquo;t make your code async just for the sake of it. Only do so for a reason, e.g. to avoid blocking the UI, or because the API calls you&amp;rsquo;re making are async, or to avoid consuming too many threads.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As in the above case, the extra costs of consuming a &amp;ldquo;fast-path&amp;rdquo; async can be minimized in some situations. The extra costs of producing an async method cannot.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In case of the zombie virus, it&amp;rsquo;s best to prepare an emergency kit beforehand. Include a shovel.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Design change: new exception behavior for "Async Subs"&lt;/h2&gt;
&lt;p&gt;We made another change because we wanted uniformity in the behavior of exceptions in Async Subs ("void-returning asyncs" in C#).&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This hopefully won't affect anyone!&lt;/i&gt;&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1" class="MsoTableGrid" style="border-collapse: collapse; background: #ffffcc; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt;"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes;"&gt;
&lt;td width="638" valign="top" style="padding-bottom: 0in; background-color: transparent; padding-left: 5.4pt; width: 6.65in; padding-right: 5.4pt; padding-top: 0in; mso-border-alt: solid windowtext .5pt; border: windowtext 1pt solid;"&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;GUIDANCE&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;It&amp;rsquo;s fine to use async methods that are Subs (void-returning asyncs) for top-level event handlers and the like. It&amp;rsquo;s okay for these to throw exceptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;It&amp;rsquo;s fine to use async methods that are Task-returning or Task&amp;lt;T&amp;gt;-returning, and have the suffix &amp;ldquo;Async&amp;rdquo;, for your normal async methods.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;As for other acceptable uses of async methods, there are a few niche cases where it makes sense to write &amp;ldquo;fire-and-forget&amp;rdquo; Async Subs which the caller is never able to await, but these should not throw exceptions that your program is intended to handle.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;For everyone who followed that guidance, the change in behavior of exception-throwing Async Subs won't have any effect. That's because the only exception-throwing Async Subs were the top-level event handlers.&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width="319" valign="top"&gt;
&lt;p&gt;&amp;nbsp;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' First Async CTP: idiosyncratic exceptions&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; f()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"A"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; t&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"B"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;TaskEx&lt;/span&gt;.Yield()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"C"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; mso-layout-grid-align: none;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; mso-layout-grid-align: none;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' [A] Always thrown to the caller of f()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' [B] Might be thrown to caller of f(),&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' or maybe to the caller of the&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' continuation-after-t (usually the UI&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' message pump), depending on whether t&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' took the fast path or not&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' [C] Always thrown by whoever called the&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' continuation-after-Yield&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="319" valign="top"&gt;
&lt;p&gt;&amp;nbsp;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' Async CTP Refresh: uniform exceptions&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;Async&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; g()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"A"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; t&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"B"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Await&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;TaskEx&lt;/span&gt;.Yield()&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"C"&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: blue; font-size: 9.5pt;"&gt;End&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; mso-layout-grid-align: none;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; mso-layout-grid-align: none;"&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' [A] Thrown to the caller's Sync.Context&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt;"&gt;' [B] Thrown to the caller's Sync.Context&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: Consolas; color: green; font-size: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;' [C] Thrown to the caller's Sync.Context&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="319" valign="top"&gt;
&lt;p&gt;Implementation in first Async CTP:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;At the start of the async method, the compiler implicitly generates a call to&lt;br /&gt;&lt;b&gt;System.Runtime.CompilerServices.&lt;br /&gt;VoidAsyncMethodBuilder.Create()&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;This saves the current &lt;b&gt;SynchronizationContext.Current&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;It then calls &lt;b&gt;sc.OperationStarted()&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;When the method completes normally, the compiler implicitly generates a call to&lt;br /&gt;&lt;b&gt;builder.SetCompleted()&lt;/b&gt;.&lt;br /&gt;This calls &lt;b&gt;sc.OperationCompleted()&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;If the method completed due to an exception, the compiler implicitly generates a call to&lt;br /&gt;&lt;b&gt;builder.SetCompleted().&lt;br /&gt;&lt;/b&gt;This calls &lt;b&gt;sc.OperationCompleted()&lt;/b&gt;.&lt;br /&gt;Next, the compiler lets the exception propagate up the callstack.&lt;/li&gt;
&lt;/ol&gt;&lt;/td&gt;
&lt;td width="319" valign="top"&gt;
&lt;p&gt;Implementation in CTP Refresh:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;At the start of the async method, the compiler implicitly generates a call to&lt;br /&gt;&lt;b&gt;System.Runtime.CompilerServices.&lt;br /&gt;AsyncVoidMethodBuilder.Create()&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;This saves the current&lt;br /&gt;&lt;b&gt;SynchronizationContext.Current&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;It then calls &lt;b&gt;&lt;span style="background-color: #ffff00;"&gt;sc.OperationStarted()&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;When the method completes normally, the compiler implicitly generates a call to&lt;br /&gt;&lt;b&gt;builder.SetCompleted()&lt;/b&gt;.&lt;br /&gt;This calls &lt;b&gt;&lt;span style="background-color: #ffff00;"&gt;sc.OperationCompleted()&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;If the method completed due to an exception, the compiler implicitly generates a call to&lt;br /&gt;&lt;b&gt;builder.SetException(ex)&lt;/b&gt;.&lt;br /&gt;This calls &lt;b&gt;&lt;span style="background-color: #ffff00;"&gt;sc.OperationCompleted()&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;It then does &lt;b&gt;&lt;span style="background-color: #ffff00;"&gt;sc.Post&lt;/span&gt;( () =&amp;gt;&lt;span style="background-color: #ffff00;"&gt; throw ex &lt;/span&gt;)&lt;/b&gt;.&lt;/li&gt;
&lt;/ol&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10154525" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Async CTP Refresh - its state and direction</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/14/async-ctp-refresh-its-state-and-direction.aspx</link><pubDate>Thu, 14 Apr 2011 16:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10153994</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10153994</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/04/14/async-ctp-refresh-its-state-and-direction.aspx#comments</comments><description>&lt;h1&gt;Async CTP Refresh - its state and direction&lt;/h1&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We really appreciate everyone who has installed the Async CTP. It has given us tremendous feedback. We appreciate all the discussion and bug reports that have come from users. We made the CTP uninstallable to encourage people to test it.&lt;/p&gt;
&lt;p&gt;But this is just a CTP. You install it, use it and deploy apps with it &lt;i&gt;at your own&lt;/i&gt; risk. This and the following four blog posts will give you raw information to help you make an informed judgment about the state of the CTP.&lt;/p&gt;
&lt;p&gt;We do not provide support for the Async CTP. We wanted to get the CTP out early, and so haven't held it up to the same quality standards as we will for the final polished release of async that's coming in the next version of Visual Studio. But I'd like to point out that Microsoft has &lt;i&gt;already&lt;/i&gt; released a polished version of "Async"...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;span style="background-color: #ffff00;"&gt;F# has already shipped with Async in Visual Studio 2010.&lt;br /&gt;It is high quality, robust, tested, flexible, and supported by Microsoft.&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;I personally think F# is a great language -- ahead of the curve, so that if you learn F# then you'll be a couple of years ahead of your peers. Indeed, F# introduced Async first.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Q. What issues are there in the Async CTP?&lt;/h2&gt;
&lt;p&gt;We've discovered close to 400 bugs in async since the first CTP, thanks to feedback from early adopters and thanks to the phenomenal testers in the MS Languages QA team. I'll analyze those 400 bugs over the next four days:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://blogs.msdn.com/b/lucian/archive/2011/04/15/async-ctp-refresh-design-changes.aspx"&gt;Design changes in the Async CTP Refresh&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://blogs.msdn.com/b/lucian/archive/2011/04/16/async-ctp-refresh-compiler-bug-fixes.aspx"&gt;Bugs fixed in the Async CTP Refresh&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://blogs.msdn.com/b/lucian/archive/2011/04/17/async-ctp-refresh-what-bugs-remain-in-it.aspx"&gt;Known and unknown bugs in the Async CTP Refresh&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://blogs.msdn.com/b/lucian/archive/2011/04/18/async-ctp-refresh-mitigation-strategies.aspx"&gt;Mitigations when using the Async CTP Refresh&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;The first Async CTP was an early branch of our main development code base. We have spent all our bug-fixing work on that main codebase, which will eventually ship with the next Visual Studio.&lt;/p&gt;
&lt;p&gt;We have back-ported only a handful of bug-fixes from the main codebase back into the Async CTP Refresh - mainly ones to do with quality of code-generation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Q. Why not just release a supported out-of-band Async feature already?&lt;br /&gt;Q. Why delay it until the next release of Visual Studio?&lt;br /&gt;Q. Why not put &lt;em&gt;all&lt;/em&gt; the bug-fixes into the CTP Refresh?&lt;/h2&gt;
&lt;p&gt;Async is a &lt;i&gt;huge&lt;/i&gt; feature! I think it will change the way most people program. We have to do it right, to make it consumable by everyone rather than just early-adopters. Here's some of what has to happen:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;1. Language support in C# and VB&lt;br /&gt;&lt;/b&gt;The CTP only contains about half of the language support. It doesn't yet support proper overload resolution with async lambdas, nor lambda type inference, nor async expression lambdas, nor late-bound await.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;2. IDE support&lt;br /&gt;&lt;/b&gt;Debugger support, GenerateFromUsage, Intellisense - all are absent from the CTP&lt;/p&gt;
&lt;p&gt;&lt;b&gt;3. Adding async APIs to the .NET framework&lt;br /&gt;&lt;/b&gt;The CTP threw together a bunch of extension methods to make existing async APIs support the language feature, but we need to properly engineer all of them, and think about new APIs that should have async versions.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;4. Bringing the support libraries to other platforms, such as Windows Phone 7 and Silverlight&lt;br /&gt;&lt;/b&gt;The CTP had a provisional AsyncCtpLibrary_Silverlight.dll, and the CTP Refresh has a provisional AsyncCtpLibrary_Phone.dll, but these are not in a final state. We can make them faster and cleaner if we engineer them properly.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;5. Making ASP work with async&lt;br /&gt;&lt;/b&gt;The CTP has an ASP async sample, but we think we can bake async support more powerfully into ASP.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;6. Unit-testing&lt;br /&gt;&lt;/b&gt;The CTP Refresh has a unit-testing sample, but we've put it out as an exploration of what should be done - not the final answer&lt;/p&gt;
&lt;p&gt;&lt;b&gt;7. Inventing the new design patterns for async programming, and guidance&lt;br /&gt;&lt;/b&gt;The new style of async programming, from F# and now C#/VB, has not been used widely before. We think it will become ubiquitous. But no one yet has the programming maturity to know what are the best design practices around async. It'll take Microsoft and the wider community both time and experience before we figure out how best to use async. We can't be sure we've got the feature right until we've got more real-world experience. And we'd never want to commit something into the C#/VB languages until we're sure it's right.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In all, to do Async right we need wholesale work on all of VS and on all of .NET. It can never be done just by a CTP. It is the kind of disruptive change that requires a whole new release of VS.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Q. Will my Async CTP code still work the same when the next VS is released and I upgrade to it?&lt;/h2&gt;
&lt;p&gt;&lt;i&gt;NO!&lt;/i&gt;&amp;nbsp; Your current Async CTP Refresh code &lt;i&gt;will require changes&lt;/i&gt; when the next VS is released and you upgrade to it... Here are the chief differences:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;TaskEx class&lt;br /&gt;&lt;/b&gt;In the Async CTP you have to use &lt;span style="color: #33cccc;"&gt;TaskEx&lt;/span&gt; everywhere. In the final version, we'll be rolling all these things into the main &lt;span style="color: #33cccc;"&gt;Task&lt;/span&gt; class.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Overload resolution and type inference&lt;br /&gt;&lt;/b&gt;The Async CTP does not implement overload resolution of async lambdas properly, nor type inference. If you pass an async lambda then it might pick different overloads when you upgrade to the next VS. This was a real issue for us in the CTP where we had to separate &lt;span style="color: #33cccc;"&gt;TaskEx&lt;/span&gt;.Run and &lt;span style="color: #33cccc;"&gt;TaskEx&lt;/span&gt;.RunEx to work around the overload-resolution limitations.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Order of evaluation&lt;/b&gt;&lt;br /&gt;The Async CTP has the wrong order of evaluation for compound expressions. In particular, it evaluates all await expressions in a statement first, and then execute the rest of the statement afterwards. Thus, "&lt;span style="color: #0000ff;"&gt;if&lt;/span&gt; (f() &lt;span style="color: #0000ff;"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;await&lt;/span&gt; g())" in the CTP will always evaluate g() and await it first, even if f() returns &lt;span style="color: #0000ff;"&gt;false&lt;/span&gt;. The next version of VS will have the correct order of evaluation. To make this fix we actually had to overhaul a large part of the codegen side of the compilers. We thought this too risky, at this stage,&amp;nbsp;to back-port to the CTP Refresh.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Extension-method APIs&lt;br /&gt;&lt;/b&gt;The Async CTP uses extension methods to provide async versions of the .NET APIs. The next release of VS will have them as instance methods. Overload resolution rules treats extension methods differently from instance methods, and so the next release may&amp;nbsp;cause subtle differences in overload resolution.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Precedence&lt;/b&gt;&lt;br /&gt;The Async CTP has the wrong precedence for the &lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; operator in VB. It should have highest precedence, but actually has lowest. For instance, "&lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; e + &lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; f" is parsed in the CTP as if it&amp;nbsp;were "&lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; (e + &lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; f)," but&amp;nbsp;in the final release it will parse as&amp;nbsp;"(&lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; e) + (&lt;span style="color: #0000ff;"&gt;Await&lt;/span&gt; f)" .&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10153994" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Async CTP Refresh - Installation</title><link>http://blogs.msdn.com/b/lucian/archive/2011/04/13/async-ctp-refresh-installation.aspx</link><pubDate>Wed, 13 Apr 2011 15:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10153373</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10153373</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2011/04/13/async-ctp-refresh-installation.aspx#comments</comments><description>&lt;h1&gt;Async CTP Refresh - installation&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;The &lt;a href="http://msdn.com/vstudio/async/" title="Async CTP Refresh"&gt;Async CTP Refresh&lt;/a&gt; was announced on 13th April 2011.&amp;nbsp;It includes Visual Studio 2010 SP1 compatibility,&amp;nbsp;enables Windows Phone 7 development,&amp;nbsp;has a new EULA with updates regarding usage in production environments, and&amp;nbsp;is compatible with non-English installations of Visual Studio and with Visual Studio Express.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The Async CTP Refresh has installed cleanly for most people. But we have had reports of a few problems. Here's some trouble-shooting for the installation process.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;span style="color: #ff0000;"&gt;FIRST: If you had previously installed the first Async CTP, first uninstall it before installing the Refresh.&lt;br /&gt;(Uninstall may ask for your original VS2010 installation media, and will probably need a reboot).&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Set aside some time. This is how long it took me with a superfast internet connection and SSD hard drive:&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;i&gt;30 minutes to uninstall the first Async CTP&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;30 mins to download+install the &lt;/i&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49b9d0c5-6597-4313-912a-f0cca9c7d277"&gt;&lt;i&gt;Windows Phone Dev Tools&lt;/i&gt;&lt;/a&gt;&lt;i&gt;, and &lt;/i&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4e97ea70-e479-4c05-814f-639d71690e5d"&gt;&lt;i&gt;VB for phone developers&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;2&amp;nbsp;hours to download+install &lt;/i&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5&amp;amp;displaylang=en"&gt;&lt;i&gt;Visual Studio 2010 SP1&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;1 hour to download+install the &lt;/i&gt;&lt;a href="http://msdn.com/vstudio/async/"&gt;&lt;i&gt;Async CTP Refresh&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;span style="color: #ff0000;"&gt;COMMON FIX: A fix for most installation problems is (1) uninstall Async CTP, then (2) reinstall it.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;To uninstall the Async CTP:&lt;/i&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;i&gt;Go to Start &amp;gt; ControlPanel &amp;gt; Uninstall &amp;gt; Updates&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Search for all the updates with "Async" in their names&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;And uninstall them. There may be 1, 2 or 3 updates to uninstall - about 30 minutes on my machine.&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;A quick check that the Async CTP Refresh has installed correctly&lt;/h2&gt;
&lt;p&gt;If you suspect there's something wrong with your installation of the Async CTP, then please check the version information of these four files. (Please check all four of them, even if you're not doing C# or VB or Phone development!)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1. C:\Windows\Microsoft.Net\Framework\v4.0.30319\&lt;b&gt;csc.exe&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;2. C:\Windows\Microsoft.Net\Framework\v4.0.30319\&lt;b&gt;vbc.exe&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;3. C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\&lt;b&gt;msvbide.dll&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;4. My Documents\Microsoft Visual Studio Async CTP\Samples\&lt;b&gt;AsyncCtpLibrary_Phone.dll&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you see the following version numbers, then the Async CTP Refresh has been correctly installed:&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr style="background-color: black; color: white;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;&lt;span style="color: #ffffff;"&gt;&lt;strong&gt;csc.exe&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;span style="color: #ffffff;"&gt;&lt;strong&gt;vbc.exe&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;span style="color: #ffffff;"&gt;&lt;strong&gt;msvbide.dll&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="color: #ffffff;"&gt;AsyncCTPLibrary_Phone.dll&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: yellow;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&lt;b&gt;CTP-Refresh&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;4.0.30319.440&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.440 &lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&amp;nbsp;4.0.40219.15 &lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&amp;nbsp;1.0.0.0&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q. How to find those version numbers? A. Right-click on each file and choose Properties; the version number is in the "Details" tab.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/3187.async_2D00_refresh_2D00_version_2D00_1.png" border="0" /&gt;&amp;nbsp; &amp;nbsp;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/1121.async_2D00_refresh_2D00_version_2D00_2.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If the version numbers are incorrect:&lt;/h2&gt;
&lt;p&gt;Here are the other version numbers you might find.&lt;/p&gt;
&lt;table cellpadding="0" cellspacing="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr style="background-color: black;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #ffffff;"&gt;csc.exe&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #ffffff;"&gt;vbc.exe&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #ffffff;"&gt;msvbide.dll&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #ffffff;"&gt;AsyncCTPLibrary_Phone.dll&lt;/span&gt;l&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #aaaaaa;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&lt;b&gt;VS2010&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;4.0.30319.1&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.1&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.1&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;i&gt;absent&lt;/i&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #aaaaaa;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&lt;b&gt;Async CTP 1&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;4.0.30319.326&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.326&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.326&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;i&gt;absent&lt;/i&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: #aaaaaa;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&lt;b&gt;VS2010 SP1&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;4.0.30319.1&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.225&lt;br /&gt;10.0.30319.431&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.40219.1&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;&lt;i&gt;absent&lt;/i&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="background-color: yellow;"&gt;
&lt;td width="96" valign="top"&gt;
&lt;p&gt;&lt;b&gt;Async CTP Refresh&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="100" valign="top"&gt;
&lt;p&gt;4.0.30319.440&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.30319.440&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;10.0.40219.15&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;p&gt;1.0.0.0&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please verify that &lt;b&gt;&lt;i&gt;all four&lt;/i&gt;&lt;/b&gt; version numbers are correctly that of the Async CTP Refresh. If they're not, then you should uninstall+reinstall:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;span style="color: #ff0000;"&gt;COMMON FIX: A fix for most installation problems is (1) uninstall Async CTP, then (2) reinstall it.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;I want to stress this: you should check the version numbers of &lt;b&gt;&lt;i&gt;all four files&lt;/i&gt;&lt;/b&gt;. Even if you think you're not going to use C#, say, you should still check all four files including csc.exe. Any discrepancy in any of the files will indicate your machine is in an incorrect state, and you should uninstall then reinstall.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If the installer says "You&amp;nbsp;need SP1" but you already have SP1&lt;/h2&gt;
&lt;p&gt;There's a bug in the Async Installer to do with Express versions of VS. The situation: if you have VS Express with SP1, and try to install the Async CTP, then it will complain that SP1 isn't installed. The workaround is to temporarily add a key to the registry. Details here:&lt;br /&gt;&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/async/thread/356cbf95-11ab-44d6-bea2-f2682ccb7b8e"&gt;http://social.msdn.microsoft.com/Forums/en-US/async/thread/356cbf95-11ab-44d6-bea2-f2682ccb7b8e&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If the "Phone" samples fail to load&lt;/h2&gt;
&lt;p&gt;If you don't have the &lt;b&gt;Windows Phone Dev Tools&lt;/b&gt; installed, then the Phone samples will fail to load in VS.&lt;/p&gt;
&lt;p&gt;The fix is the same as always:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First, uninstall the Async CTP&lt;/li&gt;
&lt;li&gt;Next, download+install the &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49b9d0c5-6597-4313-912a-f0cca9c7d277"&gt;Windows Phone Developer Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Next, download+install &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4e97ea70-e479-4c05-814f-639d71690e5d"&gt;VB For Windows Phone Developer Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Next, download+install &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5&amp;amp;displaylang=en"&gt;Visual Studio 2010 SP1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Next, download+install the &lt;a href="http://msdn.com/vstudio/async/"&gt;Async CTP Refresh&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that the order here is important! The Async CTP &lt;i&gt;must&lt;/i&gt; be uninstalled before you do anything else. The phone tools &lt;i&gt;must&lt;/i&gt; be installed before SP1. The Async CTP &lt;i&gt;must&lt;/i&gt; come last.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If the "Phone" samples cause VS to crash when you try to load them&lt;/h2&gt;
&lt;p&gt;If you don't have the &lt;b&gt;VB For Windows Phone&lt;/b&gt; installed, then the VB Phone samples will &lt;i&gt;crash VS&lt;/i&gt; when you try to load them.&lt;/p&gt;
&lt;p&gt;In this case you can get by with a much easier fix:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Just download+install &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4e97ea70-e479-4c05-814f-639d71690e5d"&gt;VB For Windows Phone Developer Tools&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If the version numbers are CORRECT but you get errors in VS&lt;/h2&gt;
&lt;p&gt;Some users have reported that the four version numbers are all correct, but they still get squiggly underlines within Visual Studio.&lt;/p&gt;
&lt;p&gt;This is typically due to a third-party extension which is not aware of the new async keywords.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;If you still have errors&lt;/h2&gt;
&lt;p&gt;Please post a request for help in the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/async/threads"&gt;Async Discussion Forums&lt;/a&gt;. We do monitor those forums frequently, and we may be able to help.&lt;/p&gt;
&lt;p&gt;When you ask for help, &lt;i&gt;PLEASE&lt;/i&gt; mention all four file version numbers. That will help!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PS. Many thanks to &lt;a href="http://jaapsuter.com"&gt;Jaap Suter&lt;/a&gt; for spotting a typo in the version tables.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10153373" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>A technical introduction to the Async CTP</title><link>http://blogs.msdn.com/b/lucian/archive/2010/10/29/a-technical-walk-through-all-of-the-async-ctp.aspx</link><pubDate>Fri, 29 Oct 2010 08:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082604</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10082604</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/10/29/a-technical-walk-through-all-of-the-async-ctp.aspx#comments</comments><description>&lt;p&gt;I made&amp;nbsp;this slide deck that covers &lt;i&gt;all&lt;/i&gt; of the Async CTP technically.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[powerpoint] &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/4861.Technical-intro-to-the-Async-CTP.pptx"&gt;A technical introduction to the Async CTP.pptx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[pdf] &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/4466.Technical-intro-to-the-Async-CTP.pdf"&gt;A technical introduction to the Async CTP.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here are its contents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;[100-level] Straightforward explanation of when and how to use Async&lt;/b&gt; 
&lt;ul&gt;
&lt;li&gt;What is the difference between "asynchrony" and "concurrency" -- and when to use them (and when not)&lt;/li&gt;
&lt;li&gt;Why asynchrony is different from "running on a background thread"&lt;/li&gt;
&lt;li&gt;How to use the async+await keywords&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;[200-level]&amp;nbsp; How exactly does an async program behave?&lt;/b&gt; 
&lt;ul&gt;
&lt;li&gt;A detailed animation of control-flow of an async method&lt;/li&gt;
&lt;li&gt;What happens on the UI thread, IOCP (IO Completion Port) threads, and the UI message-queue&lt;/li&gt;
&lt;li&gt;What is the new "Task Asynchronous Pattern" (TAP) in the framework&lt;/li&gt;
&lt;li&gt;How to&amp;nbsp;use cancellation in the TAP, and push or pull approaches to progress-notification&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;[300-level] What library-authors should know about async&lt;/b&gt; 
&lt;ul&gt;
&lt;li&gt;How to make your own&amp;nbsp;types awaitable&lt;/li&gt;
&lt;li&gt;How to implement TAP-like APIs yourself&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;[400-level] How is async implemented? How was it designed?&lt;/b&gt; 
&lt;ul&gt;
&lt;li&gt;Full details of the compiler transformation -- how it rewrites asynchronous methods, and how it deals with try/catch blocks&lt;/li&gt;
&lt;li&gt;Discussion and explanation of several design decisions we made&lt;/li&gt;
&lt;li&gt;How&amp;nbsp;Async relates to existing computer science theory.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/7357.async_2D00_control_2D00_flow.gif" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082604" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/4861.Technical-intro-to-the-Async-CTP.pptx" length="1708321" type="application/octet-stream" /><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Async CTP: developer stories</title><link>http://blogs.msdn.com/b/lucian/archive/2010/10/28/async-ctp-development-stories.aspx</link><pubDate>Thu, 28 Oct 2010 10:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082267</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10082267</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/10/28/async-ctp-development-stories.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;We've shipped the Async CTP! And VB also has iterators!&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I'm writing this blog post at 8.30pm on the evening before the &lt;a href="http://msdn.com/vstudio/async"&gt;Async CTP&lt;/a&gt; will ship. We're all pretty nervous and excited. Most of the Async/VB/C# team are at an "MVP&amp;nbsp;Insiders" party. I'm sitting here fretting over code and writing tutorials.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Excited, and writing tutorials&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I've been working on concurrency for my entire professional life, since graduating from college in 1995.&amp;nbsp;And despite this background I have to say that the ideas in the Async CTP took me quite by surprise.&amp;nbsp;The ideas&amp;nbsp;came from F# Async Workflows and from the Axum prototype released by Microsoft last year, and we've&amp;nbsp;developed&amp;nbsp;them further&amp;nbsp;to make them&amp;nbsp;fit fluently into&amp;nbsp;C# and VB.&lt;/p&gt;
&lt;p&gt;Because the ideas are fairly new, there hasn't been much academic literature on the subject, nor textbooks, nor training courses.&amp;nbsp;We're having to invent new concepts and patterns, and then figure out the most effective way to teach those concepts.&lt;/p&gt;
&lt;p&gt;One of those surprising&amp;nbsp;concepts is that &lt;i&gt;asynchrony doesn't mean "background thread"&lt;/i&gt;.&amp;nbsp;Most people think it does! It's a little cocky for us to come out and tell the world "you've been using the word 'async' wrongly all these years", but that's what we're doing.&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-family: Consolas; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';"&gt;Async&lt;/span&gt;&lt;span style="font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';"&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; DoWork() &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Task&lt;br /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;' ... CPU-bound work to compute fast fourier transforms&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"&gt;&lt;span style="font-family: Consolas; font-size: 10pt; mso-fareast-font-family: 'Times New Roman';"&gt;&lt;span style="color: blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When people look at this code, about 80% will see the word Async and&amp;nbsp;immediately assume that it's going to run that&amp;nbsp;work on a background thread. Those are the approximate results of our initial usability studies and internal testing. Of course, that's not what it actually means. What it means is that the method might have Await expressions in it, and (if it does) then it might end up returning its resultant Task before the body of the method has actually completed. I'll spell out our motives for co-opting the word "async" in a future post.&lt;/p&gt;
&lt;p&gt;Another&amp;nbsp;surprising concept is that of &lt;i&gt;single-threaded concurrency&lt;/i&gt;. It shouldn't&amp;nbsp;have been&amp;nbsp;so surprising, since people have been doing cooperative multitasking for decades -- including in Windows 3.1 with the Yield keyword, and before that CallCC in Scheme and ML, and always with co-routines. But I think that the Await keyword makes cooperative multitasking more valuable now than it has been in the past. I'll be writing more about why we like this approach (as compared to the "zillions of threads" approach of the Go language, for instance), in a future post.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-06/6471.thread.jpg" border="0" /&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nervous, and fretting over code&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;We've spent the last week building an installer, testing it, signing it, and preparing release material.&lt;/p&gt;
&lt;p&gt;Today (the day before we ship the CTP) we discovered a serious bug where VB's XML-literals didn't work in async or iterator methods, so&amp;nbsp;I fixed the bug, hastily tested it, we scrapped the installer and started rebuilding it over from scratch. That process takes several hours and involves the cooperation and good will of many kind people in the company. The Async CTP touches about 5% of the .cpp and .h files that make up the C# and VB compilers. I wrote much of the CTP, and so feel personally responsible for every bug.&lt;/p&gt;
&lt;p&gt;Now (the evening before we ship the CTP) I just discovered another serious bug where VB will crash if a variable's type is inferred from an await expression and then you double-dot off it, e.g. "Dim result = Await t : result.Descendants.ToString()". I've fixed the bug, and I have to figure out whether to drag people away from their party, start a rebuild of the installer, and jeopardize the timing of the release in case&amp;nbsp;it doesn't finish in time.&lt;/p&gt;
&lt;p&gt;I think it's not quite that serious: everyone can have their party and their sleep, and the fix can be left&amp;nbsp;for an update in a few days' time or maybe skipped entirely.&lt;/p&gt;
&lt;p&gt;This&amp;nbsp;Async CTP&amp;nbsp;has been largely an "underground" project by a small group of 5 program-managers. Microsoft divides its employees into three categories: &lt;i&gt;developers&lt;/i&gt; who write code,&amp;nbsp;&lt;i&gt;testers&lt;/i&gt;&amp;nbsp;who test it, and &lt;i&gt;program managers&lt;/i&gt; who&amp;nbsp;look after&amp;nbsp;specifications and deadlines.&amp;nbsp;For most of the CTP's development cycle, we five PMs had to fill all three roles to build something substantial enough that management would approve it. This meant many late nights --&amp;nbsp;on some weeks sleeping more nights at the office than at home. What made&amp;nbsp;all this effort&amp;nbsp;worthwhile was the&amp;nbsp;joy of working with such smart colleagues, and the satisfaction of finally being able to&amp;nbsp;implement, refine and publish the answer that those smart colleagues delivered to the research question I first started asking in 1995: "&lt;i&gt;how should you&amp;nbsp;think about&amp;nbsp;concurrency and make it usable for everyday programming?&lt;/i&gt;"&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082267" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/async/">async</category></item><item><title>Teched Tweets</title><link>http://blogs.msdn.com/b/lucian/archive/2010/06/09/teched-tweets.aspx</link><pubDate>Wed, 09 Jun 2010 14:42:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10022314</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10022314</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/06/09/teched-tweets.aspx#comments</comments><description>&lt;p&gt;I'm giving a talk at TechEd 2010 (New Orleans) now.&lt;/p&gt;
&lt;p&gt;I wrote a little VB app to display live tweets about #teched with "VB" in them. The source code's here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10022314" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-02-23-14/TechedTweets.zip" length="20006" type="application/x-zip-compressed" /></item><item><title>How to write a VS2010 Extension using Statement Lambdas</title><link>http://blogs.msdn.com/b/lucian/archive/2010/04/29/how-to-write-a-vs2010-extension-using-statement-lambdas.aspx</link><pubDate>Thu, 29 Apr 2010 22:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10004853</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=10004853</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/04/29/how-to-write-a-vs2010-extension-using-statement-lambdas.aspx#comments</comments><description>&lt;p&gt;Here's how to write a VS2010 extension (".vsix") in Visual Basic. The code is made a lot easier thanks to one of the major new features in Visual Basic 10, "statement lambdas".&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This extension&amp;nbsp;renders comments in&amp;nbsp;a new typeface, Comic Sans&amp;nbsp;Bold Italic.&lt;/li&gt;
&lt;li&gt;You can write extensions that put any kind of WPF graphical effect in the buffer.&lt;/li&gt;
&lt;li&gt;[I've made a channel9 video to accompany this blogpost, and it's in the middle of processing....]&lt;/li&gt;
&lt;li&gt;Source code: &lt;a href="http://blogs.msdn.com/lucian/attachment/10004853.ashx"&gt;ComicComments-src.zip&lt;/a&gt; [9k]&lt;/li&gt;
&lt;li&gt;Prebuilt binary: &lt;a href="http://blogs.msdn.com/lucian/attachment/10004845.ashx"&gt;ComicComments.vsix&lt;/a&gt; [26k]&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img height="413" width="480" src="http://blogs.msdn.com/photos/ljw1004/images/10004849/original.aspx" style="width: 480px; height: 413px;" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;0. PRELIMINARIES&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Install the VS2010 SDK from here: &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;MSDN documentation about it is here: &lt;a href="http://msdn.microsoft.com/en-us/library/bb166441(VS.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/bb166441(VS.80).aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. CREATE THE PROJECT&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;File &amp;gt; New &amp;gt; Project &amp;gt; Extensibility &amp;gt; EditorClassifier&lt;/p&gt;
&lt;p&gt;This creates a new project. It created it with three source files:&lt;br /&gt;&amp;nbsp; - EditorClassifier1.vb&lt;br /&gt;&amp;nbsp; -&amp;nbsp;EditorClassifier1Format.vb&lt;br /&gt;&amp;nbsp; - EditorClassifier1Type.vb&lt;/p&gt;
&lt;p&gt;This was a bit more complexity than we need. I deleted the last two from the project, and replaced the source code of EditorClassifier1.vb with just the following:&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Imports&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; System.ComponentModel.Composition&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Imports&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; System.Windows&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Imports&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; System.Windows.Media&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Imports&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; Microsoft.VisualStudio.Text.Classification&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Imports&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; Microsoft.VisualStudio.Text.Editor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Imports&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; Microsoft.VisualStudio.Utilities&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Export&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;GetType&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;IWpfTextViewCreationListener&lt;/span&gt;)), &lt;span style="COLOR: #2b91af"&gt;ContentType&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"code"&lt;/span&gt;), &lt;span style="COLOR: #2b91af"&gt;TextViewRole&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;PredefinedTextViewRoles&lt;/span&gt;.Document)&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;Class&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; &lt;span style="COLOR: #2b91af"&gt;ViewCreationListener&lt;/span&gt; : &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextViewCreationListener&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Import&lt;/span&gt;()&amp;gt; &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; formatMapService &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IClassificationFormatMapService&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Import&lt;/span&gt;()&amp;gt; &lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; typeRegistry &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IClassificationTypeRegistryService&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; TextViewCreated(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; view &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextView&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextViewCreationListener&lt;/span&gt;.TextViewCreated&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt"&gt;End&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt; &lt;span style="COLOR: blue"&gt;Class&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The &amp;lt;Export&amp;gt; and &amp;lt;Import&amp;gt; attributes show you that the extension is a MEF component. The long and short of it is that our code TextViewCreated will be invoked once for each new code-editor buffer.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. CHANGE THE FORMAT MAP: FIRST ATTEMPT&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here's the first attempt at implementing TextViewCreated:&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;Public&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; TextViewCreated(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; view &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextView&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextViewCreationListener&lt;/span&gt;.TextViewCreated&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; formatMap = formatMapService.GetClassificationFormatMap(view)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; textClassification = typeRegistry.GetClassificationType(&lt;span style="COLOR: #a31515"&gt;"text"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; textProperties = formatMap.GetTextProperties(textClassification)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentClassification = typeRegistry.GetClassificationType(&lt;span style="COLOR: #a31515"&gt;"comment"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentProperties = formatMap.GetTextProperties(commentClassification)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentTypeface2 = &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Typeface&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;FontFamily&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Comic Sans"&lt;/span&gt;), &lt;span style="COLOR: #2b91af"&gt;FontStyles&lt;/span&gt;.Italic, &lt;span style="COLOR: #2b91af"&gt;FontWeights&lt;/span&gt;.Bold, commentProperties.Typeface.Stretch)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentEmSize2 = textProperties.FontRenderingEmSize + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentProperties2 = commentProperties.SetTypeface(commentTypeface2).SetFontRenderingEmSize(commentEmSize2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;formatMap.SetTextProperties(commentClassification, commentProperties2)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;End&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Each language &lt;em&gt;classifies&lt;/em&gt; the text in the buffer, as "comment" or "text" or "typename". The &lt;em&gt;formatMap&lt;/em&gt; is a map from classification to typeface. The line in yellow is where we update the map.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. CHANGE THE FORMAT MAP: FINAL ATTEMPT&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There are some problems with the above code. The first problem is that TextViewChanged can be called more than once, but the highlighted line of code is quite costly -- it causes an entire UI refresh. We can avoid this cost by only changing the map if necessary:&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;If&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt; &lt;span style="COLOR: blue"&gt;Not&lt;/span&gt; commentProperties.Equals(commentProperties2) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;formatMap.SetTextProperties(commentClassification, commentProperties2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;End&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The second problem is that sometimes TextViewChanged isn't called at the right time. It might be called too early, for instance. To make it more robust we should also update the formatMap the first time the window gets focus, in response to the &lt;em&gt;view.GotAggregateFocus&lt;/em&gt; event.&lt;/p&gt;
&lt;p&gt;The third problem is that, if some other plugin made a change to the formatMap, or if the user changed font size for instance, then we need to redo our work on the formatMap. The right place to do this is in response to the &lt;em&gt;formatMap.ClassificationFormatMappingChanged&lt;/em&gt; event.&lt;/p&gt;
&lt;p&gt;The final problem is that if we respond to the &lt;em&gt;formatMap.ClassificationFormatMappingChanged&lt;/em&gt; event by calling &lt;em&gt;formatMap.SetTextProperties&lt;/em&gt;, then that might itself trigger the&amp;nbsp;&lt;em&gt;formatMap.ClassificationFormatMappingChanged&lt;/em&gt; event again! So we need to protect against being recursively called by ourselves.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;All these problems can be elegantly solved with a multi-line statement lambda.&lt;/em&gt;&lt;/strong&gt; This is how:&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;Public&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt; TextViewCreated(&lt;span style="COLOR: blue"&gt;ByVal&lt;/span&gt; view &lt;span style="COLOR: blue"&gt;As&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextView&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;Implements&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IWpfTextViewCreationListener&lt;/span&gt;.TextViewCreated&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; formatMap = formatMapService.GetClassificationFormatMap(view)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;inUpdate&lt;/span&gt; = &lt;span style="COLOR: blue"&gt;False&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;FixComments =&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; BACKGROUND: yellow; FONT-SIZE: 8pt; mso-highlight: yellow; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;()&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;If&lt;/span&gt; &lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;inUpdate&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Return&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Else&lt;/span&gt; inUpdate = &lt;span style="COLOR: blue"&gt;True&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; textClassification = typeRegistry.GetClassificationType(&lt;span style="COLOR: #a31515"&gt;"text"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; textProperties = formatMap.GetTextProperties(textClassification)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentClassification = typeRegistry.GetClassificationType(&lt;span style="COLOR: #a31515"&gt;"comment"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentProperties = formatMap.GetTextProperties(commentClassification)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentTypeface2 = &lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Typeface&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;New&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;FontFamily&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"Comic Sans"&lt;/span&gt;), &lt;span style="COLOR: #2b91af"&gt;FontStyles&lt;/span&gt;.Italic, &lt;span style="COLOR: #2b91af"&gt;FontWeights&lt;/span&gt;.Bold, commentProperties.Typeface.Stretch)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentEmSize2 = textProperties.FontRenderingEmSize + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;Dim&lt;/span&gt; commentProperties2 = commentProperties.SetTypeface(commentTypeface2).SetFontRenderingEmSize(commentEmSize2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;If&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Not&lt;/span&gt; commentProperties.Equals(commentProperties2) &lt;span style="COLOR: blue"&gt;Then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;formatMap.SetTextProperties(commentClassification, commentProperties2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;If&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt;inUpdate&lt;/span&gt; = &lt;span style="COLOR: blue"&gt;False&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;End&lt;/span&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow"&gt;AddHandler&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt; view.GotAggregateFocus&lt;/span&gt;, FixComments&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow"&gt;AddHandler&lt;/span&gt;&lt;span style="BACKGROUND: yellow; mso-highlight: yellow"&gt; formatMap.ClassificationFormatMappingChanged&lt;/span&gt;, FixComments&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FixComments()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt;End&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt; mso-bidi-font-size: 9.5pt"&gt; &lt;span style="COLOR: blue"&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The yellow highlights show the key changes.&lt;/p&gt;
&lt;p&gt;What's good about using a lambda for this is that we can keep everything &lt;em&gt;local&lt;/em&gt; to the place where it's needed. That's because the FixComments lambda is able to use the various fields (&lt;em&gt;view, formatMap, inUpdate&lt;/em&gt;) directly. If we tried to turn FixComments into a normal named method, then we'd have to create a class which had those three things as members, and we'd have to write a constructor for it, and the code would start to look messy.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.&amp;nbsp;DEBUGGING AND DEPLOYING&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;source.extensions.vsixmanifest&lt;/em&gt;&lt;/strong&gt; -- this file contains name and other information about your plugin. You must supply some additional files:&lt;br /&gt;&amp;nbsp; - some kind of "license.txt" of your chosing&lt;br /&gt;&amp;nbsp; - an icon 32x32 pixels big (I use PNG format)&lt;br /&gt;&amp;nbsp; - another icon 200x200 pixels big (again I use PNG)&lt;/p&gt;
&lt;p&gt;To debug, just press F5 as normal. This will launch a version of VS2010 with your extension installed. However, it installs it into an "Experimental" folder&lt;br /&gt;&amp;nbsp;&amp;nbsp; C:\Users\lwischik\AppData\Local\Microsoft\VisualStudio\&lt;strong&gt;10.0Exp&lt;/strong&gt;&lt;br /&gt;rather than the more usual&lt;br /&gt;&amp;nbsp;&amp;nbsp; C:\Users\lwischik\AppData\Local\Microsoft\VisualStudio\10.0&lt;br /&gt;All new editor-classification projects have been set up to debug by launching VS with the command-line argument "/rootsuffix Exp", which is why it looked in that experimental folder. This is so that you can debug without compromising the real VS.&lt;/p&gt;
&lt;p&gt;Once it's finished, you can deploy. The extension is packaged up in your EditorClassifier1\bin\Debug folder in a file called&lt;br /&gt;&amp;nbsp; - EditorClassifier1.vsix&lt;/p&gt;
&lt;p&gt;Any user can double-click on this .vsix to install the extension. Internally, it's really just a .zip file that contains the necessary files.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10004853" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-00-48-53/ComicComments_2D00_src.zip" length="8643" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/lucian/archive/tags/plugin/">plugin</category></item><item><title>Req28: Override events</title><link>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req28-override-events.aspx</link><pubDate>Fri, 05 Mar 2010 11:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9973334</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9973334</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req28-override-events.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: Allow you to override an event.&lt;/STRONG&gt; This idea requires some explanation. Currently, both VB and C# allow you define events in interfaces, and implement them:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Interface&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;I1&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Event&lt;/SPAN&gt; e &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Action&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Interface&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Class&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;DI&lt;/SPAN&gt; : &lt;SPAN style="COLOR: blue"&gt;Implements&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;I1&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Event&lt;/SPAN&gt; e() &lt;SPAN style="COLOR: blue"&gt;Implements&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;I1&lt;/SPAN&gt;.e&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, VB does not allow you to declare a MustInherit class with an event; and if a&amp;nbsp;library (e.g. WPF) has created such a class in C#, then VB doesn't let you inherit from that class:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;MustInherit&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;C2&lt;/SPAN&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;MustOverride&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Event&lt;/SPAN&gt; e &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Action&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' declaration disallowed in VB&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Class&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;D2&lt;/SPAN&gt; : &lt;SPAN style="COLOR: blue"&gt;Inherits&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;C2&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Overrides&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Event&lt;/SPAN&gt; e() &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Action&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' overriding disallowed in VB&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, VB doesn't let you declare an overridable event, or override it. C# does let you declare the overridable event but it behaves incorrectly when you try to actually override it...&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Class&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;C3&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Overridable&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Event&lt;/SPAN&gt; e &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Action&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' declaration disallowed in VB&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Class&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Class&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;D3&lt;/SPAN&gt; : &lt;SPAN style="COLOR: blue"&gt;Inherits&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;C3&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Overrides&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Event&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Action&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' overriding disallowed in VB; buggy in C#&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Class&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA:&lt;/STRONG&gt; We should allow users to inherit from MustInherit classes and override their MustOverride events.&lt;/P&gt;
&lt;P&gt;This is a parity issue. Without this, VB users are simply unable to use classes such as System.Windows.Documents.Serialization.SerializationWriter (which is a MustInherit class with a MustOverride event). Note that this is entirely CLS-compliant. The only VB workaround is mock-type injection voodoo.&lt;/P&gt;
&lt;P&gt;We could go further and allow declaration of MustInherit or Overridable events, and we could go even further and provide a correct&amp;nbsp;consumption of "Overridable events". But these seem like much less important.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; The most important parity issues for us are ones where VB users are shut out from libraries that are usable by C# developers. This is one such case. We therefore think this is an important problem to fix.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9973334" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req27: Allow query syntax in For Each</title><link>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req27-allow-query-syntax-in-for-each.aspx</link><pubDate>Fri, 05 Mar 2010 10:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9973329</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9973329</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req27-allow-query-syntax-in-for-each.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: Allow "For Each x In collection Where x&amp;gt;10", and other query expressions.&lt;/STRONG&gt; We should allow this kind of code:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;For&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Each&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt; collection &lt;SPAN style="COLOR: blue"&gt;Where&lt;/SPAN&gt; x &amp;gt; 5&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Currently we're forced to use awkward workarounds:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;For&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Each&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;From&lt;/SPAN&gt; x_ &lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt; collection &lt;SPAN style="COLOR: blue"&gt;Where&lt;/SPAN&gt; x_ &amp;gt; 5&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;For&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Each&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt; collection.Where(&lt;SPAN style="COLOR: blue"&gt;Function&lt;/SPAN&gt;(x_ &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;) x_ &amp;gt; 5)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;For&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Each&lt;/SPAN&gt; changedEntity &lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt; entityIndex.AllEntities.Where(&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Function&lt;/SPAN&gt;(x) x.ChangeTracker.State = &lt;SPAN style="COLOR: #2b91af"&gt;ObjectState&lt;/SPAN&gt;.Deleted)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA 1:&lt;/STRONG&gt; Allow only "Where" in For Each statements&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA 2:&lt;/STRONG&gt; Allow arbitrary LINQ queries in For Each statements&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This looks like a simple enough request, but it's not... The issue is that For Each uses the &lt;A href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253203" mce_href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253203"&gt;&lt;EM&gt;Collection Pattern&lt;/EM&gt;&lt;/A&gt;: it looks for an accessible method or extension method named GetEnumerator, and on that it looks for MoveNext/Current; or failing that it looks for IEnumerable(Of T); or failing that it looks for IEnumerable. Meanwhile, a LINQ query use the &lt;EM&gt;&lt;A href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253290" mce_href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253290"&gt;Query Pattern&lt;/A&gt;&lt;/EM&gt;: it looks for a conforming Select method, or failing that AsEnumerable/AsQueryable, or failing that Cast.&lt;/P&gt;
&lt;P&gt;How to deal with this "impedance mismatch"? One solution is to go for IDEA 1, i.e. we figure out up-front which limited set of LINQ-like operators we want to allow. The problem with this is that it's so limiting, and we might get the set of operators wrong, and they wouldn't quite behave like thier LINQ counterparts.&lt;/P&gt;
&lt;P&gt;Another solution&amp;nbsp;is to go for IDEA 2, but say that every "querying For Each" statement&amp;nbsp;is merely syntactic sugar for some LINQ query, e.g. "For Each x in coll where x&amp;gt;5" is merely syntactic sugar for "For Each x in (From&amp;nbsp;x_ in coll where x_ &amp;gt; 5)".&lt;/P&gt;
&lt;P&gt;Then we worry about performance. The compiler generates faster code when you "For Each" over an array than when you For Each over a collection. We would want "For Each x in coll Where x&amp;lt;5" to be exactly as performant as "For Each x in coll : If Not x&amp;lt;5 Then Continue".&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; We're torn. It's a nice feature. But performance concerns push us to IDEA 1 with its problems, while generality/usability concerns push us to IDEA 2 with its problems.&lt;/P&gt;
&lt;P mce_keep="true"&gt;What do you think? Would you like to see the more limited IDEA 1? With which LINQ-like query operators? Or would you prefer to see the more general IDEA 2?&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9973329" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req26: allow With as a modifier on expressions</title><link>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req26-allow-with-as-a-modifier-on-expressions.aspx</link><pubDate>Fri, 05 Mar 2010 07:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9973309</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9973309</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req26-allow-with-as-a-modifier-on-expressions.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: We should allow "With" as a modifier on expressions.&lt;/STRONG&gt; Currently the "With" object-initializer syntax is only allowed on constructors, e.g.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x = &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;S&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;With&lt;/SPAN&gt; {.p = 1, .q = 2}&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;This is rather limiting. It would be good if we could use it on factory methods, e.g.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; y = &lt;SPAN style="COLOR: #2b91af"&gt;Factory&lt;/SPAN&gt;.CreateThing() &lt;SPAN style="COLOR: blue"&gt;With&lt;/SPAN&gt; {.p = 1, .q = 2}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The cleanest way to allow this, in the language, is to allow a "With"&amp;nbsp;initializer to come after &lt;EM&gt;any&lt;/EM&gt;&amp;nbsp;expression:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Expression ::=&amp;nbsp; ...&amp;nbsp; |&amp;nbsp; Expression&amp;nbsp; ObjectMemberInitializer&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This would be syntactic sugar for evaluating the expression and then assigning its properties:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; $temp = &lt;SPAN style="COLOR: #2b91af"&gt;Factory&lt;/SPAN&gt;.CreateThing()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;$temp.p = 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;$temp.q = 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Dim&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; y = $temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; When you tell the car dealer "I'd like to buy this car but with the yellow paintjob" -- you don't expect him to get out his spraycan and change this car right here; you expect him to go to the back of the store and pick out a similar car but with one difference. Likewise, we think it will be awfully unclear to users that "With" modifies an existing object rather than constructing a new object with some variations. We think that this proposal "digs up more snakes than ladders".&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9973309" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req25: With and From should be allowed together</title><link>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req25-with-and-from-should-be-allowed-together.aspx</link><pubDate>Fri, 05 Mar 2010 04:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9973303</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9973303</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req25-with-and-from-should-be-allowed-together.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: With and From should be allowed together.&lt;/STRONG&gt; It's just a silly oversight that they're not. For example, we should allow this:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;) &lt;SPAN style="COLOR: blue"&gt;With&lt;/SPAN&gt; {.Capacity = 10} &lt;SPAN style="COLOR: blue"&gt;From&lt;/SPAN&gt; {1, 2, 3}&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; It would be nice if we'd put this into the feature when we created it in the first place. But as for adding it now -- well, it seems like it wouldn't really add much value to many users. We think there are better ways to spend our development time.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9973303" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req24: warnings where "Nothing" isn't null</title><link>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req24-warnings-where-nothing-isn-t-null.aspx</link><pubDate>Fri, 05 Mar 2010 03:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9973295</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9973295</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req24-warnings-where-nothing-isn-t-null.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: Emit a warning where "Nothing" is used in a likely-incorrect way.&lt;/STRONG&gt; 99% of users think that "Nothing" means the same as C#'s "null", i.e. a null reference or empty nullable -- &lt;EM&gt;but it isn't&lt;/EM&gt;. Nothing is instead the same as C#'s "default(T)". Also, 99% of users don't realise that VB does null-propagation for all operators including the equality operator. We should give warnings in cases where we're overwhelmingly sure that Nothing is being misused.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 1.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;? = &lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;False&lt;/SPAN&gt;, 1, &lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt;)&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: green"&gt;' gives x.HasValue=True, x.Value=0&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;It's hard, though, to know exactly what conditions would trigger the warning. One example condition, which would catch the above case, is "Warn when Nothing means the same thing as the number 0, since the user should have just written 0 instead".&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 2.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Boolean&lt;/SPAN&gt;? = &lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt; x = &lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"is nothing"&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: green"&gt;' doesn't print anything&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Contrary to common expectations, this code doesn't print anything. The condition we could use to catch this is, "Warn when the user writes an equality operator &lt;EM&gt;expr = Nothing&lt;/EM&gt; or &lt;EM&gt;Nothing = expr&lt;/EM&gt; in the case where &lt;EM&gt;expr&lt;/EM&gt; has nullable type." And indeed in VS2010 we already did introduce this warning!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 3.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Private&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; _AccessLevel &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;Public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Property&lt;/SPAN&gt; AccessLevel &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Get&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Return&lt;/SPAN&gt; _AccessLevel&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Get&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Set&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt; v &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Integer&lt;/SPAN&gt;?)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt; _AccessLevel &lt;SPAN style="COLOR: blue"&gt;Is&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;OrElse&lt;/SPAN&gt; _AccessLevel &amp;lt;&amp;gt; v &lt;SPAN style="COLOR: blue"&gt;Then&lt;/SPAN&gt; _AccessLevel = v&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;End&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;Set&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;End&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt; &lt;SPAN style="COLOR: blue"&gt;Property&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;AccessLevel = 15&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;AccessLevel = &lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt"&gt;Console&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;.WriteLine(AccessLevel)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: green; FONT-SIZE: 9.5pt"&gt;' prints 15: the second assignment didn't do what we expected&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;In this case the user has written the wrong conditions inside the property setter. The condition we could use to catch this? I don't know. It's not clear. But note that in this case the expression "_AccessLevel &amp;lt;&amp;gt; v" has type Boolean?. Bill McCarthy suggested that we emit a warning whenever a comparison operator (&amp;lt;, &amp;gt;, &amp;lt;&amp;gt;, =) produces a Boolean? but is used in a conditional statement that expects just a Boolean. It's a clever idea but I worry it will have too many false positives.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Other ideas.&lt;/STRONG&gt; One possibility is to add two new keywords to VB, "null" and "default(T)" like in C#. Then we could deprecate "Nothing". This would be a bit of a shame in some cases, though, e.g.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Sub&lt;/SPAN&gt; f(&lt;SPAN style="COLOR: blue"&gt;Optional&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;ByVal&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IntPtr&lt;/SPAN&gt; = &lt;SPAN style="COLOR: blue"&gt;Nothing&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; f(&lt;SPAN style="COLOR: #2b91af"&gt;IntPtr&lt;/SPAN&gt; x = &lt;SPAN style="COLOR: blue"&gt;default&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IntPtr&lt;/SPAN&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;But in general, we think that throwing in extra keywords which do almost the same as existing keywords is a bad idea (witness the current confusion over CType vs DirectCast vs TryCast vs CTypeDynamic). We would also not want to deprecate a code construct that's used in 99% of user projects out there.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; Adding extra warnings is a good idea. We're not sure we've figured out exactly the right conditions that would trigger the warnings, though. We worry that the conditions above will produce &lt;EM&gt;false positives&lt;/EM&gt;, i.e. they will warn in perfectly legitimate code. We also worry that they will produce &lt;EM&gt;false negatives&lt;/EM&gt;, i.e. they will fail to detect cases that should be caught.&lt;/P&gt;
&lt;P&gt;If you have been burnt by "Nothing" not being null, please post with your code snippets. That will help us evaluate whether our conditions are appropriate. Thanks!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9973295" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req23: Make more keywords contextual</title><link>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req23-make-more-keywords-contextual.aspx</link><pubDate>Fri, 05 Mar 2010 03:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9973283</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9973283</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/03/05/req23-make-more-keywords-contextual.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: Make more keywords contextual, rather than reserved.&lt;/STRONG&gt; At the moment lots of words like "Event" and "Next" and "AddHandler" are reserved keywords. If you want to have variables or methods with these names then you have to put them in brackets, "[Event]" and "[Next]" and "[AddHandler]". We should change the compiler so it allows these to be used as identifiers in contexts where it's not ambiguous.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doing this would help those of us who are re-implementing the VB compiler in VB! It would also help with things like WPF which has a method named AddHandler. Since VB is so English-like, the English-speaking programmers tend to run into clashes with VB more than they do with other languages. "Next" and "End" are particularly frustrating because they're such natural words do use for your own identifiers.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Incidentally,&amp;nbsp;you can currently use all keywords as identifiers if they come AFTER a dot, e.g. it's fine to write "Dim x = Fred.Next" or "Dim y = MyClass.Of({1,2,3})". The only exception is "New", where Fred.New isn't allowed (except bizarely in the case of Enums).&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; This is a nice idea, but it doesn't seem very important.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9973283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req21: Allow unambiguous types from ambiguous namespaces</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/16/req21-allow-unambiguous-types-from-ambiguous-namespaces.aspx</link><pubDate>Tue, 16 Feb 2010 02:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9964004</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9964004</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/02/16/req21-allow-unambiguous-types-from-ambiguous-namespaces.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: Allow unambiguous types from ambiguous namespaces.&lt;/STRONG&gt; This request&amp;nbsp;arises from VB's powerful "import" feature, which is more flexible than that of C#, but which introduces problems. I'll explain by example:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; ComponentModel.&lt;SPAN style="COLOR: #2b91af"&gt;INotifyPropertyChanged&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' In Winforms apps, this is ambiguous&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' between System.ComponentModel and System.Windows.Forms.ComponentModel&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="COLOR: green"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;If you write this code in a Console app then it compiles fine. But if you write it in a Winforms app then it's a compile-time ambiguity error. That's because Winforms apps import both "System" and "System.Windows.Forms", and the compiler doesn't know whether the prefix "ComponentModel" means System.ComponentModel or System.Windows.Forms.ComponentModel.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;It makes VB fragile against the framework introducing new types or namespaces.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;STRONG&gt;IDEA:&lt;/STRONG&gt; VB should allow "X.Y.Z" whenever the full name "X.Y.Z" is unambiguous (even if the prefix "X.Y" is ambiguous).&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;Here are some other examples:&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Threading.&lt;SPAN style="COLOR: #2b91af"&gt;Thread&lt;/SPAN&gt;.Sleep(1000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' In WPF aps, this is ambiguous&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' between System.Threading and System.Windows.Threading&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; y &lt;SPAN style="COLOR: blue"&gt;As&lt;/SPAN&gt; Xml.Linq.&lt;SPAN style="COLOR: #2b91af"&gt;XDocument&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' If you import System.Security.Cryptography, this is ambiguous&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' between System.Xml and System.Security.Cryptography.Xml&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not clear if this idea should work for ambiguous namespace and class prefixes, or merely for ambiguous namespace prefixes.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; We agree that this is a problem that would be good to fix. However, the spec rules for "unqualified and qualified name lookup" are already baffling (&lt;A href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253072" mce_href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253072"&gt;$4.7&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253227" mce_href="http://blogs.msdn.com/lucian/attachment/9954969.ashx#_Toc248253227"&gt;$11.4.4&lt;/A&gt;). This proposal would complicate them yet further. We will only consider this if we get clear and unambiguous feedback from users that they want the feature.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9964004" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req20: Range expressions</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/16/req20-range-expressions.aspx</link><pubDate>Tue, 16 Feb 2010 02:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963993</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9963993</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/02/16/req20-range-expressions.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA 1: Allow range expressions as a literal for IEnumerable.&lt;/STRONG&gt; For instance,&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' This expression&lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x = 5 &lt;SPAN style="COLOR: blue"&gt;To&lt;/SPAN&gt; 14&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' should be syntactic sugar for this one&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Dim&lt;/SPAN&gt; x = &lt;SPAN style="COLOR: #2b91af"&gt;Enumerable&lt;/SPAN&gt;.Range(5, 10)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA 2: Allow "in range" expressions.&lt;/STRONG&gt; For instance,&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' These conditions&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt; y &lt;SPAN style="COLOR: blue"&gt;In&lt;/SPAN&gt; 50 &lt;SPAN style="COLOR: blue"&gt;To&lt;/SPAN&gt; 100 &lt;SPAN style="COLOR: blue"&gt;Then ...&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt; 50 &amp;lt;= y &amp;lt;= 100 &lt;SPAN style="COLOR: blue"&gt;Then ...&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;o:p&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;' should be syntactic sugar for this one&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/o:p&gt;&lt;/SPAN&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;If&lt;/SPAN&gt; 50 &amp;lt;= y &lt;SPAN style="COLOR: blue"&gt;AndAlso&lt;/SPAN&gt; y &amp;lt;= 100 &lt;SPAN style="COLOR: blue"&gt;Then&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; The syntax for IEnumerable.Range isn't much of an improvement. As for the range-expression-tests, "50 &amp;lt;= y &amp;lt;= 100" already has a different meaning in VB, and "y In 50 To 100" isn't any clearer than the long version. We're not persuaded by these ideas.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963993" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item><item><title>Req19: Allow statements to start with parentheses</title><link>http://blogs.msdn.com/b/lucian/archive/2010/02/16/req19-allow-statements-to-start-with-parentheses.aspx</link><pubDate>Tue, 16 Feb 2010 01:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963988</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/lucian/rsscomments.aspx?WeblogPostID=9963988</wfw:commentRss><comments>http://blogs.msdn.com/b/lucian/archive/2010/02/16/req19-allow-statements-to-start-with-parentheses.aspx#comments</comments><description>&lt;P&gt;[This post is part of a series, "&lt;A href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx" mce_href="http://blogs.msdn.com/lucian/archive/2010/01/28/what-didn-t-get-into-vb10.aspx"&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;wish-list for future versions of VB&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;"]&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;IDEA: Allow statements to start with parentheses.&lt;/STRONG&gt; Currently, every statement in VB must start with either an identifier or a keyword. We should allow statements to start with arbitrary expressions. At the very least, starting with "open parentheses" would be good. It would mean that we'd no longer need "Call" in the following statement:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Call&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; Threading.&lt;SPAN style="COLOR: #2b91af"&gt;Thread&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;AddressOf&lt;/SPAN&gt; ThreadProc)).Start()&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Provisional evaluation from VB team:&lt;/STRONG&gt; It'd be a surprisingly big change to the parser code to implement this! We see that it would be useful, but don't believe it would be worth the effort to fix.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963988" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/lucian/archive/tags/PostVB10/">PostVB10</category></item></channel></rss>
