Microsoft.Bcl.Async is Now Stable

Microsoft.Bcl.Async is Now Stable

Rate This
  • Comments 49

It’s done. About five months ago, we shipped our Microsoft.Bcl.Async NuGet package which provides support for the async/await keywords for pre-.NET 4.5 platforms, such as .NET 4, Silverlight 4, and Windows Phone 7.5. Of course, this includes support for portable class libraries as well.

We believe we’ve baked Microsoft.Bcl.Async enough to flip the switch and mark it as stable. This might not sound like a big deal but it is the NuGet equivalent of shipping an RTM.


C-3PO: "Sir, it's quite possible this package is not entirely stable."

Han Solo: "Not entirely stable? Well, I'm glad you're here to tell us

these things. Chewie, take the professor in the back and

show him how to upgrade the NuGet package!"

--- Star Wars as Immo remembers it

What’s the big deal with being stable?

Being stable means the owner of that package states that API and functionality are unlikely to change and therefore suitable for use in production. This also enables 3rd parties to publish stable NuGet packages that depend on our package because NuGet prevents stable packages from depending on pre-release packages.

What about Microsoft.CompilerServices.AsyncTargetingPack?

Before we shipped Microsoft.Bcl.Async we shipped another NuGet package which was provided by the language team to gather feedback on the async and await keywords (“Async Targeting Pack”)

https://www.nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack

Our stable release of Microsoft.Bcl.Async officially supersedes the Async Targeting Pack. We haven’t removed it, but we unlisted it on NuGet so that new developers aren’t accidentally using the old version. We’ve also added a readme.txt which is automatically displayed by VS when existing consumers upgrade their package references.

Fixed Issues

The majority of customer issues we’ve seen was due to two issues:

  1. Outdated version of NuGet. In order to use the Async package from a portable class library, you need to run the NuGet 2.1 or higher. To address this in the future, we have worked with the NuGet team and NuGet 2.3 will add this ability. For now, you will need to know to install an updated version of NuGet (see instructions in section “How to Upgrade” below).
  2. Missing reference to the async package from all referencing projects. In order to make the async functionality work across all platforms, we make use of a CLR feature called assembly unification. For that to work properly, all projects must have a reference to the Async NuGet package. Since this can be easy to forget, we’ve added a warning mechanism to our package that tells you what to do. I’ll discuss this in more detail below.

After upgrading, you will see the following build warning:

 

After fixing this, you might see the following warnings:

In both cases, the project that causes the warning is missing a NuGet package reference. Adding these references will fix the warnings.

Tip: If your solution contains many projects, you may want bulk-add the async packages to several projects at once. You can do this by right clicking your solution and selecting Manage NuGet Packages for Solution. Select the NuGet package and click Manage. A dialog appears that enables you to select the projects you want to update.

Add references for Microsoft.Bcl, Microsoft.Bcl.Async, and Microsoft.Bcl.Build to all projects that show the warnings mentioned previously.

Branding

We’ve added some branding to make our packages easier to recognize. Our dotnetframework user now displays the .NET gravatar.

 

and so does our async NuGet package:

 

How to Upgrade

Important: Since our package contains portable class libraries, you need to use NuGet 2.1 or higher. You can check whether you have the latest version by going to Tools | Extensions and Updates. When the Extensions and Updates dialog opens, select Updates | Visual Studio Gallery and look for an entry titled NuGet Package Manager.

In order to upgrade to the RTM version, right click your project and select Manage NuGet Packages. In the resulting dialog, select the Updates section on the left hand side. In the center, the Async NuGet package should show up. Simply click the Update button.

Summary

Microsoft.Bcl.Async is now stable which means you can use it in production. Of course, software is never truly done, so we still want to hear from you if things don’t work for you. You can contact us via comments under this blog posts or via our NuGet contact page. Also, make sure to check out the known issues list.

  • I think I may have found an issue with the assembly unification and mixed platform targets. I have a repro project, but the steps are pretty easy.

    Here's a description of my solution with two projects and platform targets.

    Solution.sln

     > WPFProject.exe (x86)

     > SomeClassLib (AnyCPU)

    WPFProject.exe references SomeClassLib which is a C# class lib. I installed Microsoft.Bcl.Async into both projects.

    I changed the Active CPU configuration to x86. When I build the project, I get the following error.

    1>------ Skipped Build: Project: SomeClassLibrary, Configuration: Debug Any CPU ------

    1>Project not selected to build for this solution configuration

    2>------ Build started: Project: WpfApplication1, Configuration: Debug x86 ------

    2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'SomeClassLibrary.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='x86'.  This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

    Build has been canceled.

    Build Summary

    -------------

    00:00.386 - Failed  - Debug x86 - WpfApplication1\WpfApplication1.csproj

    Total build time: 00:00.404

    ========== Build: 0 succeeded or up-to-date, 1 failed, 1 skipped ==========

    Any ideas?

  • I should add that the solution built just fine before I installed the Microsoft.Bcl.Async package. And it builds if I uninstall all the Microsoft.Bcl.* packages.

  • Great news!

    Will it work with .NET Framework 3.5 as well?

  • I have the same problem as Haacked. But I can finally build the project by changing the configurations and platform so that all projects have the same name. The problem occur again when I create new configuration for just 1 project.

    It did not happen with the pre-release version either.

  • Why does the nuget page list Windows Phone 8 as a target platform. Windows Phone 8 supports these things out of the box doesn't it?

  • hello Immo. i have a big problem

    my msdn forum account is banned and there is no reason

    i did not get any email message etc

    can you please check the issue ?

    social.msdn.microsoft.com/.../monstermmorpg

    thank you

  • I'd love to work this in to our current projects that are using the AsyncTargetingPack however I would also appreciate a way to work the assembly references in without using NuGet.  We don't use NuGet for anything else and we bundle all of our referenced assemblies along with the source code so working this in as a one-off just isn't that clean for us.  If you get some time and know of an alternate deployment scenario, please let me know.

    Thanks!

  • Had posted this in the HttpClient topic but that seems closed for comments now.  And besides, it is the same issue that the BCL Build package won't install and stops everything else.  Error is below.  VS2012 with latest updates to VS and NuGet.

    Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.4)'.

    Successfully installed 'Microsoft.Bcl.Build 1.0.4'.

    Successfully installed 'Microsoft.Bcl 1.0.19'.

    Successfully uninstalled 'Microsoft.Bcl.Build 1.0.4'.

    Install failed. Rolling back...

    Could not install package 'Microsoft.Bcl.Build 1.0.4'. You are trying to install this package into a project that targets 'portable-win+net45+sl40+wp', but the package does not contain any assembly references or content files that are compatible with that framework.

  • @Bruce B: "Is Microsoft.Bcl.Async now supported for VB Web Applications?"

    Unfortunately not. The known issues document (blogs.msdn.com/.../asynctargetingpackkb.aspx lists a work around though.

    @Ted: "Is there a planned .NET 4.1 framework update to push this DLL out to our end users?"

    No, we've specifically chosen an out-of-band release vehicle for this work. There are no plans to add this support to any of the downlevel platforms (.NET 4, Silverlight or Windows Phone 7.1).

    @Christian Fredh: "Will it work with .NET Framework 3.5 as well?"

    No, you'll need at least .NET 4.

    @Haacked and @Nguy?n Quý Hy: Thanks, we've identified the root cause and are working on a fix.

    @Stilgar: "Why does the nuget page list Windows Phone 8 as a target platform. Windows Phone 8 supports these things out of the box doesn't it?"

    We've designed the downlevel work to be compatible with platforms that ship the support in-box (.NET 4.5, .NET for Windows Store, and Windows Phone 8). That was required to make portable class libraries work across all platforms. This also allows for project references between a .NET 4.5 app and a .NET 4 class library.

    @Furkan Gozukara: I'm trying to find a contact, stay tuned.

    @adamgrahamcgi: I'd like to chat a bit more about this. Can you contact me at immol at microsoft dot com? Thanks.

    @Shecky Boy: Are you running the latest version of NuGet? You can check whether you have the latest version by going to Tools | Extensions and Updates. When the Extensions and Updates dialog opens, select Updates | Visual Studio Gallery and look for an entry titled NuGet Package Manager.

  • @Furkan Gozukara: Found the right contact. For some reason, our software detected one of your posts as spam. We've fixed that so you should no longer experience any issues. Sorry for the inconvenience.

  • @Shecky Boy: It looks like your Portable Class Library is targeting Windows Phone 7.  The async targeting pack supports Windows Phone 7.5 and higher, so switch your PCL to target WP7.5 and try again.

  • I have the same problem as @Haacked and @Nguy?n.

    Great that you are working on that. Thanks a lot.

  • There is a problem with NuGet package restore. Bcl.Async alters project file to import Microsoft.Bcl.Async.targets from packages folder. This means that it expects the content of packages folder to be stored in the source control, and if not, projects won't load.

    I've manually changed projects to import targets file from .\.nuget folder and copied targets file there. But there must be a better way :-)

  • Hi guys, I think I've discovered a bug in the RC/final versions that causes WebClient.OpenReadTaskAsync to randomly throw a NullReferenceException when called from a background agent on Windows Phone.

    I've had to roll back to Microsoft.Bcl.1.0.11-beta and Microsoft.Bcl.Async.1.0.12-beta as they were the last versions to not have this behavior.

    Where is the best place for me to post the specifics?

  • I have problems running FxCop in Wpf projects when i use Async library features. Everything except FxCop works fine.

    The error message i get is:

    1>MSBUILD : error : CA0001 : The following error was encountered while reading module 'WpfApplication3': Could not resolve member reference: [Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]System.Threading.Tasks.TaskEx::Delay.

    1>  Code Analysis Complete -- 1 error(s), 0 warning(s)

    1>MSBUILD : error : Code Analysis detected errors.  See Code Analysis results window or log file for details.

    Do you have any suggestions?

    Thanks

Page 2 of 4 (49 items) 1234