Microsoft has updated the async/await targeting for .net 4.0 and now suggests using the Microsoft.Bcl.Async library available on nuget.
In the release notes, it states that .net 4 with KB 2468871 is required.
Quoting from http://support.microsoft.com/kb/2468871/en-us
Feature 5 Changes to the support portable libraries. These changes include API updates and binder modifications. This update enables the CLR to bind successfully to portable libraries so that a single DLL can run on the .NET Framework 4, on Silverlight, on Xbox, or on the Windows Phone. This update adds public Silverlight APIs to the .NET Framework 4 in the same location. The API signatures will remain consistent across the platform. All modifications are 100 percent compatible and will not break any existing code.
It turns out that without this kb installed Microsoft.Bcl crashes (it tries to bind to silverlight System.Core
library which is not on the system)
The only safe way to use async/await in .net 4.0 supporting xp users without installing KB2468871 is installing async CTP v3 in vs 2010 SP1, nuget microsoft bcl async and implementing own AsyncTaskMethodBuilder and AsyncVoidMethodBuilder. (and remove async ctp dll reference)
It is the only way any non async CTP async implementation in .net4, vs 2010, without installing vs 2012, net 4.5 or KB2468871 WILL WORK.
Any other ready to use implementation of async on .net4 out there uses the new way of implementing and bridging async code within the compiling process, that's why you need to install async CTP, it is the only async implementation for .net4, modifying the csc compiler to support it.
Microsoft has changed the types compiler use in c#5 and .net 4.5 to generate async code, basically they could it done easily for .net4, but instead they choose to force anyone to install vs 2012 and .net 4.5, something that is unacceptable for companies that need to support xp users, because you will have no way to see and fix any .net 4 bugs that was fixed in .net 4.5.
Microsoft.Bcl.Async, AsyncTargetingPack, AsyncBridge they all WON'T WORK without .net 4.5 installed or KB2468871 for .net 4.0.
They WILL ALL WORK if you implement AsyncTaskMethodBuilder and AsyncVoidMethodBuilder on your own, you can even copy/paste it's implementation from async ctp v3 with minor changes and it will just work.
So if you really concerned by the deployment requirement and other things related to supporting xp users, I would strongly advise to do is I described.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With