AsyncCTP installation problems (and VS11)


The AsyncCTP is getting a bit long in the tooth. This post is to explain how, why, and what to do.

Common symptoms:

  • AsyncCTP fails to install — i.e. it doesn’t create the “Async CTP” folder inside “My Documents”, and VS doesn’t recognize the async keywords.
  • Installing VS11 causes AsyncCTP to stop working.
  • AsyncCTP doesn’t work on Windows 8.

Explanation

The AsyncCTP is an update. It updates Visual Studio 2010 with modified versions of the VS IDE compilers that colorize the new keywords. It also updates the .NET4 framework with modified versions of the command-line csc.exe and vbc.exe compilers. But the AsyncCTP was never incorporated into Microsoft’s official source code for VS2010 or .NET4, and was never meant to be — it’s just an experimental CTP.

And so, when Microsoft produces official updates to either VS or .NET4, and they touch the same files, then they tend to overwrite the AsyncCTP — or prevent it from installing in the first place.

Also .NET45, which comes with VS11 and Win8, is an in-place update on top of .NET4, and so replaces the csc.exe and vbc.exe from the AsyncCTP with updated ones. As Stephen Toub explains, the new csc.exe and vbc.exe are incompatible with AsyncCTPLibrary.dll.

What to do

  1. Best option is to upgrade to VS11 Beta and .NET45. It has much better async support (fewer bugs, more features, better debugging, better perf)
     
  2. Failing that, if you’re stuck with VS2010 + AsyncCTP, here are ideas:
    1. If you already have VS2010 + AsyncCTP working, then don’t install VS11.
       
    2. If you have VS2010 SP1 but the AsyncCTP installer doesn’t seem to have worked, the problem might be conflicting updates such as
         KB2635973, KB2615527, KB2645410
      Any update after October 11 is liable to conflict, though. Go to ControlPanel > AddRemovePrograms > WindowsUpdates and uninstall them if present.

Platforms:

  • Targeting .NET45 with async:
    you have to use VS11 Beta, which works fine.
     
  • Targeting Silverlight5 or .NET4 with async:
    you’re currently stuck with VS2010 + AsyncCTP. We’re exploring options here to let you use VS11 instead.
     
  • Targeting Windows Phone with async:
    again you’re currently stuck with VS2010 + AsyncCTP.

 

Other ideas:

  • If you can set up a VM with only VS2010 SP1 and no updates, then AsyncCTP should install fine.
    Then you can copy the “Microsoft Visual Studio Async CTP” folder out of My Documents, to use on other machines.
     
  • From the same VM, you could go C:\Windows\Microsoft.Net\Framework and copy the following files. They constitute the entirety of AsyncCTP updates to the .NET4 framework. You could copy these files to a build machine, for instance, and then msbuild would use the AsyncCTP without needing to run the installer. (Caution! This will likely break regular .NET updates!)
    • csc.exe, vbc.exe, 1033\cscui.dll, 1033\vbc7ui.dll
       
  • It’s theoretically possible to do the same trick for VS2010, copying just the files that were modified by the AsyncCTP installer. But this is error-prone and more likely to leave VS2010 in a broken state than not.

 

NB. The AsyncCTP installer has a problem with network drives: if your My Documents is mapped to a network drive, then it won’t install.

Thoughts

We understand async has become indispensable for many of your projects. Ultimately, though, we can’t support the AsyncCTP — it’s too fragile and has too many bugs. It took us an entire release cycle to fix it, and VS11/.NET45 is the result. The only long-term supportable strategy is for people to migrate over to VS11. As soon as we’ve figured out the migrate story, we’ll let you know.

PS. If you notice other updates which conflict with AsyncCTP, please post in the comments here, and I’ll update the instructions.

 

Comments (8)

  1. Daniel Grunwald says:

    If you want to use async with .NET 4.0 while using the compiler from .NET 4.5 Beta, you can add this file to your project: gist.github.com/1961087

    (in a separate project if you are using VB; or you could port it to VB – it's not that much code)

    That's a simple implementation of the classes expected by the compiler for async support. It doesn't work exactly the same as async support in .NET 4.5 (see the comment at the start of the file), but it should be good enough for most purposes.

  2. ljw1004 says:

    Daniel, that's awesome!

    NB. VB compiler requires the types to be in a separate DLL; they can't be source code just in the same project.

  3. Jake Ginnivan says:

    Hey Lucian,

    Any timings on the migration strategy? We have a project in production on the async CTP, and I am using VS11 at work now (another project). Yet I have WP7 apps I am building on the side. The current state of play is a bit of a pain :(

    I understand the difficulty involved in trying to sort this out, especially with the changes to the state machine and use of the builder class in the beta, but it would be great to have options that don't suck :)

    In a few projects I have rewritten my async usage into TPL, but it is no where near as nice, and is far harder for other team members to understand, others the usage is far too wide spread (async is infectious in an app :P) to change.

    Cheers,

    Jake

  4. ljw1004 says:

    @Jake, I'm really sorry but we just don't have dates yet.

    The WP7 issue will be even harder on you, since it's not solely a matter of us producing async targeting pack for VS11+WP7, but also the phone team has to produce an entire new version of the phone SDK that works with VS11.

  5. AsyncBridge!

    Hi Lucian, Daniel, Jake,

    A couple of us are putting together a project called AsyncBridge (based on Daniel's gist) which lets you use async in VS 11, but target .NET 4.0. Obviously, the name is based on LINQBridge.

    nuget.org/…/AsyncBridge

    I'm planning to reimplement the same stuff that's in the AsyncCtpLibrary, like Task.Delay etc over the next few days. I think keeping the thing open source will save you guys effort while you're busy working on .NET 4.5.

    Let me know if you have any thoughts,

    Alex

  6. You forgot to mention Portable library as a "platfrom".

    While it is not really a platform we hope it can mitigate part of the pain involved with mutli platform targeting if we do decide to also target metro application. As long as all platforms you target support the async feature we expect to be able to use async in common code.

  7. Had to remove KB2736182 (+ others mentioned) in order to install successfully.

  8. Robin Ainscough says:

    This is nuts … just because I want to be able to wait for a Web Service call to finish before proceeding??  Really, this is the state of coding application using Microsoft tools in 2012 … makes me want to go back to punch cards on a PDP 11-44 (same productivity result).