tejacques / AsyncBridge

A library to help bridge C# async method execution from synchronous methods, such as in Windows Forms and ASP.NET.
Other
166 stars 30 forks source link

Any chance of getting a 4.0 version? #1

Closed ScottRapsey closed 11 years ago

ScottRapsey commented 11 years ago

Is there any chance you could create a version that works with .Net 4.0 and the Microsoft.Bcl.Async libraries https://www.nuget.org/packages/Microsoft.Bcl.Async ?

I forked and did a test, after dropping the project back to targeting '.Net Framework 4.0 Client Profile' and installing the Microsoft.Bcl.Async package the only line of code that needed changing was line 155 from Task.Run(() => to TaskEx.Run(() =>

I'm happy to rename mine to AsyncBridge40 (or something similar) and publish to nuget, but it'd be nicer if the code could be shared and in the one place somehow.

I'm not a GitHub expert and I'm not a NuGet expert, so I'm not sure what's feasible and what isn't. Let me know what you think,

cheers, Scott

tejacques commented 11 years ago

Hi Scott,

I'd love to have support for a .NET 4.0 version. If you commit the updates in your repo I'll take a look at your fork and see if there's a good way to fit it in.

Tom

ScottRapsey commented 11 years ago

Cool, I just committed to my fork at: https://github.com/ScottRapsey/AsyncBridge I didn't "Enable Nuget Package Restore" on the solution, so you'll have to manually update the packages.

I was looking up how to deal with dependencies in a nuspec file for a completely unrelated project and found that since version 2 they've had the ability for different target frameworks to have different dependencies. I hadn't read the doco since pre-2.0 so wasn't aware that it could be done. http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Dependencies

Let me know if there's anything I can do to help.

tejacques commented 11 years ago

Hi Scott,

Thanks for putting that up. I'll work on writing some tests and getting this into trunk over the weekend.

tejacques commented 11 years ago

I split out a NET 4.0 version which uses your approach and pushed it out to NuGet. I may have gotten some of the details wrong about nuget dependencies though, as it still seems to be installing the Microsoft.Bcl packages even in .NET 45. I'll look into it more later. That said, all tests pass with the new .NET 40 version and things look good there.

Thanks for pointing this out!