Due to work restrictions, I need to continue using Visual Studio 2010 for the immediate future. At the same time, I have been learning about Async in my personal coding. Is the latest Async CTP fully consistent with the Async language features of C# 5.0? And is installing the Async CTP the correct way to use Async with VS2010?
The Async CTP is the only way to use async
in Visual Studio 2010. However, it is not the async
that made it into .NET 4.5 / Visual Studio 2012, several bugs in the CTP have been fixed in the final release. You will not get these bug fixes in Visual Studio 2010, according to the CTP's readme:
NOTE ON "AS IS" LICENSE
While the Async CTP license does not prevent you using it at your own risk in production environments, we advise you not to. The goal of this CTP is solely to gather feedback on our intended async design. We did not design or build it to be used in production environments, and did not test it as thoroughly as is needed for use in production environments, and we believe it has too many flaws to be fit for use in production environments. We gratefully appreciate feedback on the Async CTP, but we do not plan to make any fixes to the Async CTP itself: the fixes we make will only appear in the eventual supported released product.
If you absolutely need VS 2010, what I would try is to install the Async CTP first, and then install .NET 4.5 (both runtime and SDK). Develop in Visual Studio, but build using the standalone compiler.
TaskEx.Run(...)
(Async CTP) versus Task.Run(...)
(.NET Framework 4.5). –
Quean async
and await
as a syntax error). .NET 4.5's standalone compiler is independent of the Async CTP compiler, and can be used to correctly compile your project, even if your project targets .NET 4.0. If you correctly combine the two, yes, you can use async
/await
. –
Quean async
, and show your boss the improvements. :) –
Quean Given the way that .NET 4.5 installs on top of .NET 4, and the challenges that that could present, I would try to separate your work environment from your personal development environment as far as possible.
You could install VS2010 and VS2012 on the same machine, and I'd recommend that over using the async CTP:
- Less pollution of your work IDE
- Up-to-date version of C# 5
- All the benefits of VS 2012 when you're using it
However, I think it would be safer to develop on a VM or a separate machine instead, if at all possible.
The least attractive option would be to use the CTP, IMO - I can see only risks on that front, to be honest.
The Async CTPs are not fully consistent with the final C# 5.0 implementation, though the keywords are the same.
If your real business need is to produce an app that can run on .NET 4.0, then the recommended approach is to use VS2012 with the async targeting pack (available via NuGet).
Under this configuration, your development machine has .NET 4.5 and VS2012, however the binary produced from your solution build will be compatible with .NET 4.0.
This results in the fullest support for the async language feature, since the VS2012 + async targeting pack gives you the exact same official compiler, and is higher than CTP quality.
© 2022 - 2024 — McMap. All rights reserved.