Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Microsoft.Bcl.Async?

What is Microsoft.Bcl.Async and what is it used for?

I've read on the package page that:

This package enables Visual Studio 2012 projects to use the new 'async' and 'await' keywords.

But as could see my VS2012 supports async and await without any extra package.

So should I install the package for my C# 4.5 'async' project?

like image 716
JohanTG Avatar asked May 13 '14 07:05

JohanTG


2 Answers

Microsoft.Bcl.Async provides the runtime types that the C# 5.0 compiler needs to use async and await.

It brings async/await support to .NET 4.0, Silverlight 4 and 5, Windows Phone Silverlight 7.1/7.5, and portable libraries that include any of those platforms. It also provides some extension methods on the Windows Phone Silverlight 8.0 platform, so it's sometimes used there even though WP8 can support async/await without it.

It does not include the ASP.NET runtime changes necessary for proper async/await support, so if you install it into an ASP.NET 4.0 project, the code will compile but will not work correctly. The only supported way to use async/await on ASP.NET is to upgrade to 4.5.

like image 96
Stephen Cleary Avatar answered Nov 18 '22 09:11

Stephen Cleary


It is a package to be able to use async and await in .NET 4.0 projects.

But be aware. I encountered the problem where these libraries cannot be used in .NET 4.5 projects. But this was before the initial release of .NET 4.5. Therefore this problem might be resolved.

like image 41
Michael Mairegger Avatar answered Nov 18 '22 10:11

Michael Mairegger