Closed
Description
Describe the bug
It seems like async lambdas are no longer supported in System.Linq.AsyncEnumerable
in .NET 10 but at the same time the compiler will raise an ambiguous reference error if System.Linq.Async
is installed.
To Reproduce
previously, with System.Linq.Async
, something along the lines of the following was possible
int number = await new List<int>() { 1, 2, 3 }.ToAsyncEnumerable()
.SingleAwaitAsync(async (value) => { await Task.Delay(500); return value.Equals(2); });
however, with System.Linq.AsyncEnumerable
, the equivalent doesn't compile
int number = await new List<int>() { 1, 2, 3 }.ToAsyncEnumerable()
.SingleAsync(async (value) => { await Task.Delay(500); return value.Equals(2); });
Exceptions (if any)
Cannot convert async lambda expression to delegate type 'Func<int, bool>'.
An async lambda expression may return void, Task or Task<T>, none of which are convertible to 'Func<int, bool>'.
Further technical details
- Visual Studio Enterprise 2022 (64-bit) 17.14.2 Preview 1.0
- .NET 10.0.100-preview.4.25258.110