Skip to content

Conversation

@idg10
Copy link
Collaborator

@idg10 idg10 commented Nov 17, 2025

Resolves #2284

As #2283 reported, there is a trap waiting for those who were using the Await forms available for various operators in Ix.NET's LINQ to IAsyncEnumerable<T> (System.Linq.Async) when they upgrade to the .NET runtime library implementation (System.Linq.AsyncEnumerable).

Our preview builds provide Obsolete attributes explaining that you need to move from, e.g., SelectAwait to Select, but the message did not mention that you will also need to change the callback signature. Whereas Ix.NET's implementation allowed you to pass a callback that does not take a cancellation token (and cancellation was available through methods with a completely different name such as SelectAwaitWithCancellation), the .NET runtime's implementation requires async callbacks to accept a CancellationToken.

So something like this:

someAsyncEnum.SelectAwait(async x => await Something(x))

needs two changes:

  1. replace SelectAwait with Select
  2. add a second argument to the callback to receive the CancellationToken

So at a minimum, that means something like this:

someAsyncEnum.Select(async (x, _) => await Something(x))

That need to add the extra parameter to accept the CancellationToken was not obvious.

This modifies the Obsolete attributes to include instructions to this effect.

@idg10 idg10 added this to the Ix 7.0 milestone Nov 17, 2025
@idg10 idg10 self-assigned this Nov 17, 2025
@idg10 idg10 marked this pull request as ready for review November 17, 2025 13:11
@idg10 idg10 merged commit 17dcefa into main Nov 17, 2025
5 checks passed
@idg10 idg10 deleted the feature/2284-ixasynclinq-obsolete-twoargs branch November 17, 2025 13:36
hmawhoob-dot pushed a commit to hmawhoob-dot/reactive that referenced this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider changing Obsolete text to clarify when callbacks need to take an additional CancellationToken

3 participants