Async CTP (SP1 Refresh)

Async CTP (SP1 Refresh)

  • Comments 13

By Robin Reynolds-Haertle

This morning, we released an updated version of the Visual Studio Async CTP (SP1 Refresh) that’s compatible with Visual Studio 2010 SP1 and Windows Phone 7!

What Is the Visual Studio Async CTP (SP1 Refresh)?

The Async CTP previews a language feature that is in the next version of Visual Basic and C#. By using this feature, you can call into asynchronous APIs without having to split your code across multiple methods or lambda expressions. No more callbacks! This is all thanks to the new await and async keywords that enable you to write asynchronous methods that can pause execution without consuming a thread, and then resume later, right where they left off.

// C#
async Task<int> SumPageSizesAsync(IList<Uri> uris)
    int total = 0;
    var statusText = new TextBox();

    foreach (var uri in uris)
        statusText.Text = string.Format("Found {0} bytes ...", total);
        var data = await new WebClient().DownloadDataTaskAsync(uri);
        total += data.Length;

    statusText.Text = string.Format("Found {0} bytes total", total);
    return total;
' Visual Basic
Async Function SumPageSizesAsync(uris As IList(Of Uri)) As Task(Of Integer)
    Dim total As Integer = 0
    Dim statusText = New TextBox()

    For Each uri In uris
        statusText.Text = String.Format("Found {0} bytes ...", total)
        Dim Data = Await New WebClient().DownloadDataTaskAsync(uri)
        total += Data.Length

    statusText.Text = String.Format("Found {0} bytes total", total)
    Return total
End Function

Note: The CTP is released with an “as is” license. This does not constitute encouragement for you to use the CTP for your production code. The CTP is a technology preview that is unsupported, and you use it at your own risk. Because we received many requests from developers asking to use the CTP for production code, we changed the license to allow using the CTP in applications you submit to the Marketplace. As always, we recommend that you test your code thoroughly.

Download and Installation

Follow these three steps, in order, to prepare your computer for the CTP:

1. If you have the previous Async CTP on your computer, uninstall it first. To do this, go to Control Panel > Uninstall a program > View installed updates, search for the two updates with “Async” in their names, and uninstall both of them.

2. If you want to do Windows Phone 7 development, install the Windows Phone Developer Tools. If you are using Visual Basic, also install Visual Basic for Windows Phone Developer Tools.

3. Install Microsoft Visual Studio 2010 Service Pack 1. You must install the service pack after you install the Windows Phone Developer Tools. If you installed Windows Phone Developer Tools after installing the service pack, you’ll need to reinstall the service pack.

Once you have completed the steps above, download and install the Visual Studio Async CTP (SP1 Refresh).

Please let us know what you think! Thanks!

Leave a Comment
  • Please add 1 and 2 and type the answer here:
  • Post
  • I remember that the last version was incompatible with another product.. I can't remember which, maybe EF?

    Is this version safe to install side by side with other products or will it break something?

  • Yes, the same question here, does this version have any conflict with MVC or any other thing installed right now?

  • Yes, the CTP is compatible with MVC 3 tools. Make sure to uninstall the first CTP if you have it installed before you install SP1. After installing SP1 you should be able to install MVC3 and Async CTP in any order you like.

  • You may want to double check the code examples in the new "C# Language Specification for Asynchronous Functions" document (

    All the implementation examples are using "if ($a1.IsCompleted)" but it needs to reverse check to be "if (!$a1.IsCompleted)" according to the specifications.

  • @zz:

    You are right. I messed up a bit when I updated the implementation examples to use the new pattern:

    * I forgot to negate the IsCompleted check, as you point out

    * I forgot to replace "EndAwait" with "GetResult" in one place

    I will collect errata for a bit and then post a fixed version online. Unfortunately we cannot update the spec that ships with the CTP download bits.

    Thanks for spotting this!

  • Does the Async CTP SP1 Refresh work with the Silverlight 5 public beta ?

  • This is really neat - at my job we use a tool called TAME to write all our C++ in this way, with async code not splitting our functions in half. I do a lot of C# programming in my free time, so I'm excited to see this kind of thing included natively.  

    One thing that's missing from your example though: how do I make multiple calls in one blocking group, so they fire simultaneously, only to continue when all have been called back?  This comes up all the time in an async architecture...I'll make something up using syntax like yours above to show what I mean:


    await  {

       var data1 = makeAsyncCallToService1();

       var data2 = makeAsyncCallToService2();

       var data3 = makeAsyncCallToService3();




    The last thing I'd want to do is call them all in serial. But I can't tell from your example how to fire them simultaneously.

  • Here's hoping MS really cares that you bought VStudio 2010, and releases a SP2;  SP1 slows things down and introduces new bugs.  Sometimes when I see all the hype surrounding an upcoming new release of studio (you know...thousands of articles and videos everywhere about how cool it is)...I just wander, do they really care I bought the previous one??  I'm tired of MS taking all the user's feedback (bugs, etc.) about the current version, then pour it all into the next one.

  • Could you elaborate on this CTP's compatibility with MVC3.

    It gets installed with no problems... However, if I try to invoke async/await function in MVC controller, the task is stuck in "WaitingForActivation" status. Is it me (that is, is there some doc / blog post / example that works), or is it not working yet, or is it a bug?

    (pretty much exactly the same command-line code works fine)


    Sorry for re-posting from - not sure which is more appropriate...

  • Hi,

    Do you know why after instllaled this libary,

    the async.dll does not appear in MyDocuments\Async CTP Samples.

    I used vs 2010, window 7.


    Daniel Shitrit

  • Async CTP (SP1 Refresh) now conflicts with the new SL 5 RC that was just released:

    Error 9 The type 'System.Threading.Tasks.TaskCompletionSource<TResult>' exists in both 'C:\Program Files (x86)\Microsoft Visual Studio Async CTP\Samples\AsyncCtpLibrary_Silverlight.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\mscorlib.dll'

  • Is the CTP refresh for x32systems only? How about x64?

  • Hi I am using AsyncCTP, I am making a  HttpWebRequest async also while reading stream I am reading stream.ReadToEndAsync but I am not able to  GetResponseStream as async

    Please look at my code and let me know How I can get [GetResponseStream Async]

                   HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("");

                   webRequest.Proxy = null;

                   var response = webRequest.GetResponseAsync();

                   var stream = response.Result.GetResponseStream();

                   using (var streamReader=new StreamReader(stream))


                       var data = streamReader.ReadToEndAsync();

                       return data.Result.ToString();



Page 1 of 1 (13 items)