Skip to content

Conversation

idg10
Copy link
Collaborator

@idg10 idg10 commented Sep 30, 2025

.NET 10 includes System.Linq.AsyncEnumerable (and this is available for older .NET runtimes as a NuGet package). This provides LINQ for IAsyncEnumerable<T>, which is the primary raison d'être of the System.Linq.Async package that is built as part of Ix.NET.

The current version of System.Linq.Async (v6) causes problems if you use it in a project where System.Linq.AsyncEnumerable is also in use (e.g., any .NET 10.0 project).

This modifies System.Linq.Async to enable it to coexist with System.Linq.AsyncEnumerable (by removing most of the functionality from the public API visible in its ref assemblies, while leaving everything present in the runtime assemblies for binary compatibility). The small amount of functionality in System.Linq.Async that has not been recreated in System.Linq.AsyncEnumerable moves into System.Interactive.Async. The goal is for projects to be able to remove System.Linq.Async, and for us to deprecate this package.

The various oddly-named overloads that take async callbacks (with suffixes such as Await and WithCancellation) remain but have been marked as [Obsolete] with messages recommending that the developer move over to their more conventionally named equivalents from System.Linq.AsyncEnumerable.

The main job at this stage was to ensure it can still compile. This starts the job of separating out the duplicated and different APIs, but most of that remains to be done.
Turns out the solution doesn't build the ref assemblies and they weren't building.

I also needed to modify the async code generator to correctly handle #if-ed out code. Turns out it was stripping the directives and then copying the disabled block of text in as leading trivia! This had the effect of copying #if-ed out methods into the generated code, making them reappear.

I've also worked through the first four files of operators.
This is more complex than anything else so far for a couple of reasons.

First this uses T4 templates to generate code which in turn contains the [GenerateAsyncOverload] attribute, so we have two levels of code generation.

Second, System.Linq.AsyncEnumerable has elected not to implement all of the functionality available in System.Linq.Async (e.g. overloads taking selector callbacks).
Fix erroneous doc comment on ZIP
@idg10 idg10 added [area] Ix System.Linq.Async deprecation Replacing `System.Linq.Async` with the .NET class library's `System.Linq.AsyncEnumerable` labels Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[area] Ix System.Linq.Async deprecation Replacing `System.Linq.Async` with the .NET class library's `System.Linq.AsyncEnumerable`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant