A library providing seamless interoperability between F# Async workflows and .NET Task/ValueTask for mixed-language asynchronous programming.
FSharp.Control.FusionTasks is a library that enables seamless interoperability between F#'s Async workflows and .NET's Task/ValueTask models. It allows F# developers to directly await .NET Tasks within async blocks and lets C# developers await F# Async computations, solving the friction when mixing asynchronous code across these two .NET languages.
F# and C# developers working on mixed-language codebases, library authors who need to expose async APIs consumable from both languages, and teams integrating .NET OSS packages that use Task/ValueTask into F# projects.
It provides a lightweight, intuitive bridge between the two async models without requiring manual boilerplate conversions, supports modern async features like IAsyncEnumerable and ValueTask, and works across a wide range of .NET platforms from .NET Framework 4.5 to .NET 6.
F# Async workflow <--> .NET Task/ValueTask easy seamless interoperability library.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows direct use of Task/ValueTask with let!, do!, and use! in F# async blocks, eliminating manual Async.AwaitTask conversions as shown in sample code for MemoryStream operations.
Enables C# code to await F# Async computations directly, simplifying mixed-language projects without extra boilerplate, demonstrated in C# sample code awaiting FSharpAsync.Sleep.
Integrates IAsyncEnumerable<T> in F# for loops and IAsyncDisposable in use expressions, supporting .NET's latest asynchronous patterns as highlighted in the features list.
Works across .NET Framework 4.5 to .NET 6, F# 4.5 to 6.0, and various .NET Core versions, ensuring broad applicability as detailed in the environments chart.
Cannot support arbitrary 'task-like' types beyond Task and ValueTask due to .NET limitations, restricting use with custom async models as explained in the appendix.
In F# async workflows, CancellationToken is handled implicitly, which may not suit scenarios needing explicit token propagation, as noted in the README's TIPS section on manual conversion.
Compiler conflicts between Async and Task types can necessitate type annotations in async workflows, adding complexity as mentioned in the TIPS section with FS0041 errors.
For IAsyncEnumerable support, it relies on Microsoft.Bcl.AsyncInterfaces, introducing an extra dependency and limiting compatibility to specific .NET versions as outlined in the notes.