<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using Asynchronous Methods in ASP.NET 4.5</title><link>http://www.asp.net</link><pubDate>Thu, 21 Jun 2012 17:06:57 GMT</pubDate><generator>umbraco</generator><description>Comments for Using Asynchronous Methods in ASP.NET 4.5</description><language>en</language><atom:link href="http://www.asp.net/rss/comments/39024" rel="self" type="application/rss+xml" /><item><title>Comment Posted by mickba</title><link>http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</link><pubDate>Fri, 08 Jun 2012 20:57:39 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015728</guid><description><![CDATA[ <p>Great article folks and good to see Async coming along.</p><p></p><p>Couple of questions:</p><p>1) is there any thread affinity with the async tasks? can I nominate which core/virtual cpu a thread can run?</p><p></p><p>2) F# has a async in it, .NET 2.0/4.0. Is this implementation different for .NET 4.5 for C#/VB.NET etc?</p><p>Cheers,</p><p></p><p>Mick.</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/mickba.jpg?forceidenticon=false&amp;dt=635046542400000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by eirenarch</title><link>http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</link><pubDate>Mon, 11 Jun 2012 04:47:21 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015742</guid><description><![CDATA[ <p>Why did you decide to have the async events run in a specific step in the page lifecycle instead of allowing developers to choose? For example you could have allowed the developer to specify that he wants the operation awaited between Load and PreRender thus giving more flexibility. I understand that you are building on top of legacy async pages from ASP.NET 2.0 but you have the code so you could certainly change it.</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/eirenarch.jpg?forceidenticon=false&amp;dt=635046542400000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ricka6</title><link>http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</link><pubDate>Mon, 11 Jun 2012 14:56:07 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015748</guid><description><![CDATA[ <p>eirenarch - Why did you decide to have the async events run in a specific step in the page lifecycle instead of allowing developers to choose?</p><p></p><p>Great question.</p><p>Supporting arbitrary async event timing in the page life-cycle would have been extremely complicated, risky and provided little benefit.  That said, you absolutely can (in RC and higher ) write async void Page_Load and other methods.  But there are caveats; see Stephen Toub&#39;s exclellent blog  What’s New for Parallelism in Visual Studio 2012 RC</p><p> <a rel="nofollow" href="http://blogs.msdn.com/b/pfxteam/archive/2012/05/31/what-s-new-for-parallelism-in-visual-studio-2012-rc.aspx" target="_blank">blogs.msdn.com/</a></p><p> Supporting it without these caveats was too risky.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/ricka6.jpg?forceidenticon=false&amp;dt=635046542400000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ricka6</title><link>http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</link><pubDate>Mon, 11 Jun 2012 15:03:47 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015749</guid><description><![CDATA[ <p></p><p>mickba: 1) is there any thread affinity with the async tasks? can I nominate which core/virtual cpu a thread can run?</p><p>Excellent quesions.</p><p> No and No.  It&#39;s possible you might be able to use a custom TaskScheduler to do that, but it&#39;s way beyond the scope of this article.</p><p></p><p>2) F# has a async in it, .NET 2.0/4.0. Is this implementation different for .NET 4.5 for C#/VB.NET etc?</p><p></p><p> See Asynchronous C# and F# (II.): How do they differ?</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/ricka6.jpg?forceidenticon=false&amp;dt=635046542400000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ricka6</title><link>http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</link><pubDate>Mon, 11 Jun 2012 20:49:52 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015750</guid><description><![CDATA[ <p>Async thread execution can be summarized as:</p><p></p><p>1.	The portion before first await is executed synchronously when invoked by the original caller.</p><p>2.	The Thread on which the await portion resumes are executed is decidable by what you are awaiting on:</p><p>The most common thing to await on is the type Task, which has smart default behavior (and all the code in this sample uses Task).</p><p>•	Defers to SynchronizationContext.Post(…) if the thread has some sync context installed.</p><p>o	For WPF, WinForms and Metro, there is a context installed on UI threads which causes this to go back to the same UI thread.</p><p>•	For ASP.Net and anything not listed above, goes to the threadpool.</p><p>o	ConfigureAwait(false) changes the “what you are awaiting on” so that it always goes to the threadpool.</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/ricka6.jpg?forceidenticon=false&amp;dt=635046542400000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ricka6</title><link>http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</link><pubDate>Thu, 21 Jun 2012 17:06:57 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015814</guid><description><![CDATA[ <p>“first await” actually refers to the first await for which the operation is considered “not complete”. Moreover, if every single awaited expression said they were complete, then no yielding/scheduling occurs at all, and the method executes completely synchronously. If you read the async language docs, all awaitable expressions follow the pattern:</p><p></p><p>   * Have a discoverable GetAwaiter() method that returns an awaiter type. Discoverable meaning that extension methods and late binding are supported.</p><p>   * The awaiter type exposes:</p><p>      - An IsCompleted property. If true, await actually does no yielding and directly manifests the result encapsulated by the awaitable</p><p>      - A GetResult() method that manifests the outcome of the awaitable. This means that if it throws an exception, if the outcome is best represented by an exception, or evaluates to a value if the operation represents an async operation that has a value. Awaitables that only observe completion can have a void return type for GetResult(), in which they can only be awaited as a top-level statement.</p><p>      - An OnCompleted(…) method – this controls the scheduling. It’s called only if the first IsCompleted test returned false, and must schedule successfully (as there’s always a chance that it completed after the first call to IsCompleted but before the OnCompleted(…) method is invoked).</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/ricka6.jpg?forceidenticon=false&amp;dt=635046542400000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>