All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…
The C# and Visual Basic compilers implement support for async/await by generating code that utilizes some specific types in the underlying framework. These types include the “awaiters” used to await things (like Tasks) as well as the “builders” used in handling the lifetime of an async method’s invocation. With the Async CTP that was released for Visual Studio 2010, all of this infrastructure was implemented in DLLs named AsyncCtpLibrary*.dll (e.g. AsyncCtpLibrary.dll, AsyncCtpLibrary_Silverlight5.dll, etc.) In .NET 4.5, these types are all in mscorlib.dll.
The particular shape of the types expected by the compiler stayed the same from the Async CTP v3 to the .NET 4.5 Developer Preview and Visual Studio 11 Developer Preview. As such, you could utilize the Visual Studio 11 Developer Preview along with the corresponding AsyncCtpLibrary*.dll to target async/await with an earlier version of the Framework than .NET 4.5 (e.g. .NET 4, Silverlight 5).
However, for a variety of security and performance reasons, the shape of the types expected by the compilers has changed for the .NET 4.5 Beta and Visual Studio 11 Beta. This means that while you can absolutely use Visual Studio 11 Beta to build apps that use async/await with .NET 4.5, you are currently unable to use Visual Studio 11 Beta to build apps that use async/await against .NET 4, Silverlight 5, etc., since the compilers in Visual Studio 11 Beta are expecting differently shaped types than those in the existing AsyncCtpLibrary* DLLs.
We’re currently discussing the situation and will share more details once we have concrete plans.
Thanks for your interest and patience,The Async CTP Team
I installed Visual Studio 11 Beta and all the async action methods that were working under the Developer Preview now cause a page load from that action to hang indefinitely. However, the site is targeting the .NET Framework 4.5. Based on what you said here, shouldn't this be expected to work?
This is ASP.NET? Can you send me an email (stoub at microsoft) with more details on the issue you're facing? Either I can answer or I'll try to route your issue to someone who can.
Stephen, I understand that changes or fixes like the one that will be required for async in SL5 to work with VS11 beta do not happen over night, but is there any kind of estimate or even a guess as to when this support will be there? This will such tremendously if we have to wait months before this support is added just like when SL5 beta was released and the async ctp v2 did work anymore because of the addition of Task to the SL5 core.
I heavily use async in SL5 and I love the VS11 beta, but can not use it at all because all the stuff I develop at work is a hybrid solution containing all the major web technologies such as HTML5, Ajax, and SL.
I understand the concern. Unfortunately I don't have an estimate to share right now.
Thanks Stephen, having that info helps - instead of hovering around the issue and working on small issues waiting for the async fix, we went back to VS2010 for the time being and will use 2011 when it's working with async. Knowing that the answer is no ETA gives us enough to make a decision and keep working.
It has been a few days since you wrote this post. Is there any updated info on this topic? will we be able to play around with AsyncCTP on VS11 beta when we are running under .NET 4.0?
Thanks Steven, I wish I had seen your post earlier. Now I am facing the perfectly reasonable error: "Error 104: Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?"
I'll try to uninstall .NET Framework 4.5 Beta and/or Visual Studio 2010 and see how it goes.
I'm having some problems with running a web site migrated from 4.0 to 4.5 and MVC 4.0.
Everything seems to work well (no exceptions) but it doesn't run asynchronously using IIS, however, it does run asyncronously when I use IIS Express.
To validate this I have created a small app that launches async calls to the web site and you can see haw it queues request when executed in IIS but runs all at the same time in IIS Express.
What am I doing wrong?
OK. To all who installed Visual Studio 11 Beta and lost support of async in their .NET 4.0 applications:
1. Uninstall Visual Studio 11 Beta
2. Repair Visual Studio 2010
3. **REINSTALL ASYNC CTP V3**
That worked like a charm for me.
Steve, should we be expecting a newer version of Async CTP (aka v4) that is compatible with Visual Studio 11 Beta?
Being able to target .net 4.0 while using async-await is probably the most important feature I want out of VS 11 Final. Without it, I won't be able to use C#5 until the market share of WinXP becomes negligible, and I expect that to take a few more years.
I'm fine with using Win7 and .net 4.5 on my dev system, and a few extra hoops such as `TaskEx` are acceptable too. But some level of .net 4.0 support is very important to me, even if it's not officially supported.
Can we expect async support for portable libraries so that we can write async code targeting for example both SL5 and .NET 4.X?
We're still working through our plans. Thanks for the interest.
Any update Stephen? Been a month since we we last told to hold on...
"we we" oops lol, meant "we were". You'd think after 30 years programming I'd know how to type.
Hi Scott- We should have an update very soon. Thanks for your patience.