<?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>await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx</link><description>One of the very cool things about the new await keyword in C# and Visual Basic is that it&amp;rsquo;s pattern based. It works great with Task and Task&amp;lt;TResult&amp;gt;, and awaiting those two types will represent the vast majority of uses, but they&amp;rsquo;re</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10271292</link><pubDate>Thu, 23 Feb 2012 03:06:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10271292</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;Hi Ido-&lt;/p&gt;
&lt;p&gt;I&amp;#39;m glad you like the post, and thanks for the feedback. &amp;nbsp;To be clear, neither of those control or culture examples actually ship in the Framework, and I was simply showing the kinds of things that are possible with the pattern. &amp;nbsp;Whether you choose to do this in your own code is entirely up to you :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10271292" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10271234</link><pubDate>Wed, 22 Feb 2012 22:11:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10271234</guid><dc:creator>It's that abuse?</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This post is very interesting and show the power of using a pattern instead of concrete types.&lt;/p&gt;
&lt;p&gt;The thing that bugs me is that the last two ideas of await button and await culture seem like an abuse to me.&lt;/p&gt;
&lt;p&gt;I can read and understand what await DownloadAsync means but reading await button is not logical to me. I can see why it working but in order to understand that you have to know the internal implementation of both Awaiter pattern and SynchornizationContext, both of which should be hidden if used correctly.&lt;/p&gt;
&lt;p&gt;As a comparison - I can add operator ++ to Thread which change it&amp;#39;s priority but it will just abuse operator overloading.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s only my opinion :)&lt;/p&gt;
&lt;p&gt;Thanks for the great work of finally bring great async pattern that works even on UI code.&lt;/p&gt;
&lt;p&gt;Ido&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10271234" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10135962</link><pubDate>Wed, 02 Mar 2011 13:01:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10135962</guid><dc:creator>Alex Petersen</dc:creator><description>&lt;p&gt;This is awesome stuff. I can already imagine how easy it would be to write coroutines using async/await.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10135962" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10116351</link><pubDate>Sun, 16 Jan 2011 19:49:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10116351</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;Hi yzorg-&lt;/p&gt;
&lt;p&gt;Thanks for the feedback and suggestion. &amp;nbsp;It is likely that you&amp;#39;ll need to wait for a beta release in order to get such documentation, but we&amp;#39;ll see if there&amp;#39;s something we can do in the meantime (e.g. putting together a CHM file that documents the new members).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10116351" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10115955</link><pubDate>Fri, 14 Jan 2011 19:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10115955</guid><dc:creator>yzorg</dc:creator><description>&lt;p&gt;I love what I&amp;#39;m seeing, but I&amp;#39;m a practitioner and not an early adopter. &amp;nbsp;I think you&amp;#39;d get more adoption from practitioners if documentation for TaskEx was up on MSDN library somewhere. &amp;nbsp;(I think I&amp;#39;d use it in my personal PowerShell and data migration code, of course not production uses). &amp;nbsp;Any ETA on when there will be basic docs on MSDN for the new CTP types like TaskEx? &amp;nbsp;Would we have to wait for a .NET 5 beta?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10115955" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10115861</link><pubDate>Fri, 14 Jan 2011 16:05:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10115861</guid><dc:creator>tobi</dc:creator><description>&lt;p&gt;I would add another con: There is a perfectly valid workaround to not having an interface and achieving basically the same thing: Task.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10115861" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10115854</link><pubDate>Fri, 14 Jan 2011 15:52:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10115854</guid><dc:creator>Lucian Wischik, MSFT</dc:creator><description>&lt;p&gt;Paul, we spent a long time evaluating IAwaitable before deciding against it. Here are some of the factors.&lt;/p&gt;
&lt;p&gt;(1. PRO) If would be good for &amp;quot;Await&amp;quot; to be like &amp;quot;For Each&amp;quot;. For Each first looks to see if its argument satisfies the enumerable pattern. If not, it looks for an interface IEnumerable&amp;lt;T&amp;gt; / IEnumerable and uses that. It would be clean if Await did the same thing.&lt;/p&gt;
&lt;p&gt;(2. CON) At the moment we have a large set of Task-related combinators, e.g. Task.WaitAll and Task.WaitAny, that operate upon tasks. To make IAwaitable usable, we&amp;#39;d have to add extra overloads of them take IAwaitable as well.&lt;/p&gt;
&lt;p&gt;(3. -) Actually, not all awaitables are peers. We wouldn&amp;#39;t want &amp;quot;Task.WhenAll(Task.Run(...), Task.Yield())&amp;quot; to typecheck. It doesn&amp;#39;t make sense. We kind of like that the type system keeps them apart. (Of course it still could even with IAwaitable, in the same way that you can For Each over things that aren&amp;#39;t IEnumerable).&lt;/p&gt;
&lt;p&gt;(4. CON) Users would have to decide all the time whether their API surface area should deal in Tasks or IAwaitables -- a decision that most would have to make without it actually benefitting them.&lt;/p&gt;
&lt;p&gt;(5. CON) We&amp;#39;d have to decide async methods should have return type Task or IAwaitable or both. If Task, then it adds to user confusion about whether their signatures should have Task or IAwaitable. If IAwaitable, then it cuts users off from all the existing Task-based APIs. If both, then it adds to user confusion about what their async method should return.&lt;/p&gt;
&lt;p&gt;(6. PRO) If we created an IEnumerable, then users could write their own libraries of combinators that operate over anyone&amp;#39;s awaitable stuff.&lt;/p&gt;
&lt;p&gt;(7. CON) At this stage, we have only one and a half good examples of things that are awaitable -- namely, Task and maybe IObservable. It&amp;#39;d be a mistake to create a fundamental framework type like IAwaitable with so few uses of it.&lt;/p&gt;
&lt;p&gt;(8. CON) IAwaitable feels a bit like IObservable.&lt;/p&gt;
&lt;p&gt;I think it was 5+7 that were the biggest factors in our decision.&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;Lucian Wischik, VB language PM&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10115854" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10115840</link><pubDate>Fri, 14 Jan 2011 15:35:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10115840</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;Tridex, glad you like it! &amp;nbsp;Enjoy your weekend :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10115840" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10115839</link><pubDate>Fri, 14 Jan 2011 15:34:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10115839</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;tobi, oops, in my haste I wrote Set instead of TrySet. &amp;nbsp;Fixed above.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10115839" width="1" height="1"&gt;</description></item><item><title>re: await anything;</title><link>http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115642.aspx#10115797</link><pubDate>Fri, 14 Jan 2011 13:39:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10115797</guid><dc:creator>tobi</dc:creator><description>&lt;p&gt;There is a race condition here:&lt;/p&gt;
&lt;p&gt;process.Exited += (s, e) =&amp;gt; tcs.SetResult(process.ExitCode); &lt;/p&gt;
&lt;p&gt;if (process.HasExited) tcs.SetResult(process.ExitCode);&lt;/p&gt;
&lt;p&gt;It might detect exit twice.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10115797" width="1" height="1"&gt;</description></item></channel></rss>