I've problem installing VS-SP1 and Async CTP V3 on my machine. For some reason it cause any .NET application I run on that machine to crash. (good thing I'm using virtual machine and I can roll-back).
I've copy the update csc.exe file into .NET framework 4 directory in my Windows directory.
When I build my project with msbuild from command line everything build and works great.
When I compile the same project from within VS2010 I get compile time error that the async keyword is unknown.
I don't care that VS does not highlight the syntax of async and await but it does bother me that I have to build the project from command line.
How come the command line csc works but when using VS it does not?
How can I change VS to compile the async code properly (without installing Async CTP itself)?
Thank you,
Ido.
VS2012 and the Async targeting pack is the best option, for the following reasons:
A small caveat is that installing VS2012 on a machine with VS2010 + Async CTP breaks the Async CTP. You won't be able to use the VS2010 version to compile Async code anymore.
As an example where the async behavior is important, consider the following very simple way of retrying a task. While the function compiles with the Async CTP, it fails SILENTLY (as in application termination silently) if an exception occurs:
private static async Task<T> Retry<T>(Func<T> func, int retryCount)
{
while (true)
{
try
{
var result = await Task.Run(func);
return result;
}
catch
{
if (retryCount == 0)
throw;
retryCount--;
}
}
}
That said, I've been using the Async CTP for over a year now and the only issue was the installation order after adding Visual Studio 2010 SP1. If you get the order wrong the Asycn CTP won't install and you will have to remove SP1 and reinstall everything in the proper order.
Still, I would move to 2012 and the targeting pack as soon as is practical (ie the entire team is ready to switch), to avoid multiple code versions and the annoying exception behavior.