-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Description
I've been trying to apply the suggestions for the expected breaking changes regarding the System.Linq.Async nuget. However, I'm not able to get to a working configuration. Between ToAsyncEnumerable
being ambiguous and AnyAwaitAsync
seemingly gone.
Reproduction Steps
In a class library referencing System.Linq.Async
targeting net9.0
and net10.0
, I have these reduced (and now nonsensical) extension methods.
public static class MyExtensions
{
public static ValueTask<bool> AnyAwaitConcurrent<TSource>(
this IAsyncEnumerable<TSource> items,
Predicate<TSource> predicate,
CancellationToken cancellationToken = default)
=> items.AnyAwaitAsync(x => ValueTask.FromResult(predicate(x)), cancellationToken);
public static IAsyncEnumerable<T> MyToAsyncEnumerable<T>(this IEnumerable<T> source)
=> source.ToAsyncEnumerable();
}
This code compiles for net9.0
Expected behavior
There are clear migration steps and available APIs for this code to continue to work.
Actual behavior
For net10.0
:
As given, it's reporting the documented ambiguous method since .NET 10 now comes with a base class library method, but the documented fixes also break the code.
Since it's a direct reference in a multi-target library, I'm supposed to reference System.Linq.AsyncEnumerable
instead. This, however, breaks the call to AnyAwaitAsync
since this extension method isn't available in that setup.
Regression?
It's a known breaking change, but the resolution steps are at least unclear. I'm inclined to say:
Yes.
Known Workarounds
There might be a way to call the correct extension methods using assembly aliases, but I have no clue how to declare those with framework assemblies.
Configuration
10.0.100-rc.1.25451.107
Other information
No response