Showing results for 2012 - Page 16 of 16 - .NET Blog

Feb 6, 2012
Post comments count0
Post likes count0

FromAsync(asyncResult, …) vs FromAsync(beginMethod, …)

Stephen Toub - MSFT
Stephen Toub - MSFT

The Task Parallel Library (TPL) provides a set of “FromAsync” helper methods that create a Task or a Task<TResult> to represent an invocation of an APM method pair, i.e. BeginXx / EndXx.  There are, however, two different flavors among these overloads: ones that accept an IAsyncResult “asyncResult” as the first pa...

.NET Parallel Programming
Feb 4, 2012
Post comments count0
Post likes count2

Building a custom GetOrAdd method for ConcurrentDictionary

Stephen Toub - MSFT
Stephen Toub - MSFT

I was recently asked by a developer about getting some additional information out of ConcurrentDictionary<TKey,TValue>’s GetOrAdd method.  As a reminder, GetOrAdd either returns the value for a key currently in the dictionary, or if that key doesn’t have a value, it adds a value for the key as dictated by either a TValue prov...

.NET Parallel Programming
Feb 3, 2012
Post comments count0
Post likes count0

Know Thine Implicit Allocations

Stephen Toub - MSFT
Stephen Toub - MSFT

For .NET 4.5, we’ve invested quite a bit of effort into performance, and in particular for the Task Parallel Library (Joe Hoag wrote a good paper covering some of these improvements).  We focused such effort on TPL because it is a core component used in async programming and at a foundational level for many libraries and applications.&nb...

.NET Parallel Programming
Feb 2, 2012
Post comments count2
Post likes count1

Await, SynchronizationContext, and Console Apps: Part 3

Stephen Toub - MSFT
Stephen Toub - MSFT

In Part 1 and Part 2 of this short series, I demonstrated how you can build a SynchronizationContext and use it run an async method such that all of the continuations in that method will run on serialized on the current thread.  This can be helpful when executing async methods in a console app, or in a unit test framework that doesn’t di...

.NET Parallel Programming
Jan 31, 2012
Post comments count0
Post likes count0

KB2650605 QFE : VS2010 sp1 VB web form editor may not become editable during debugging

Web Development Tools Microsoft
Web Development Tools Microsoft

We recently released a VS2010 sp1 QFE KB2650605 to solve a VB editor debugging problem.  During VB web form debugging, VB web form may become un-editable if there are server tags inside.  If you develop and debug VB web forms, you might be interested to download this QFE. http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails...

ASP.NET
Jan 23, 2012
Post comments count2
Post likes count0

Advanced APM Consumption in Async Methods

Stephen Toub - MSFT
Stephen Toub - MSFT

I’ve previously blogged about how to expose existing Asynchronous Programming Model (APM) implementations as Task-based methods.  This can be done manually using a TaskCompletionSource<TResult>, or it can be done using the built-in wrapper provided in TPL via the Task.Factory.FromAsync method.  By creating a Task-based wrapper...

.NET Parallel Programming
Jan 21, 2012
Post comments count0
Post likes count0

Await, SynchronizationContext, and Console Apps: Part 2

Stephen Toub - MSFT
Stephen Toub - MSFT

Yesterday, I blogged about how you can implement a custom SynchronizationContext in order to pump the continuations used by async methods so that they may be processed on a single, dedicated thread.  I also highlighted that this is basically what UI frameworks like Windows Forms and Windows Presentation Foundation do with their message pumps.N...

.NET Parallel Programming
Jan 20, 2012
Post comments count0
Post likes count0

Implementing a SynchronizationContext.SendAsync method

Stephen Toub - MSFT
Stephen Toub - MSFT

I recently saw two unrelated questions, the answers to which combine to form a potentially useful code snippet.The first question was about SynchronizationContext.  SynchronizationContext provides a Post method, which asynchronously schedules the supplied delegate and object state to be executed according to the SynchronizationContext’s ...

.NET Parallel Programming
Jan 20, 2012
Post comments count4
Post likes count3

Await, SynchronizationContext, and Console Apps

Stephen Toub - MSFT
Stephen Toub - MSFT

When I discuss the new async language features of C# and Visual Basic, one of the attributes I ascribe to the await keyword is that it “tries to bring you back to where you were.” For example, if you use await on the UI thread of your WPF application, the code that comes after the await completes should run back on that same UI thread. ...

.NET Parallel Programming
Jan 14, 2012
Post comments count0
Post likes count0

FAQ on Task.Start

Stephen Toub - MSFT
Stephen Toub - MSFT

Recently I’ve heard a number of folks asking about Task.Start, when and when not to use it, how it behaves,and so forth.  I thought I’d answer some of those questions here in an attempt to clarify and put to rest any misconceptions about what it is and what it does.1. Question: When can I use Task.Start?The Start instance method ma...

.NET Parallel Programming