System.Linq.AsyncEnumerable in .NET 10
.NET 10 introduces the AsyncEnumerable
class, which provides a full set of LINQ extension methods for the IAsyncEnumerable<T> type. This class replaces the community-maintained System.Linq.Async
NuGet library, potentially causing compilation errors due to ambiguities.
Version introduced
.NET 10 Preview 1
Previous behavior
The AsyncEnumerable
class in the System.Linq.Async
package provided LINQ support for IAsyncEnumerable<T>.
New behavior
The AsyncEnumerable
class in .NET 10, as well as in the System.Linq.AsyncEnumerable
NuGet package, provides LINQ support for IAsyncEnumerable<T>.
Type of breaking change
This is a source incompatible change.
Reason for change
IAsyncEnumerable<T> has become core enough that the platform itself should provide LINQ support for the type. Community support, including from the maintainers of System.Linq.Async
, petitioned for this inclusion directly in the platform.
Recommended action
If upgrading to .NET 10 and the code includes a direct package reference to System.Linq.Async
, remove that package reference. For multitargeting both .NET 10 and previous versions, add a package reference to System.Linq.AsyncEnumerable
instead.
If System.Linq.Async
is consumed indirectly via another package, avoid ambiguity errors by including this in the project:
<PackageReference Include="System.Linq.Async" Version="6.0.1">
<ExcludeAssets>all</ExcludeAssets>
</PackageReference>
Most consuming code will not need changes, but some call sites might need updates to refer to newer names and signatures.
Affected APIs
System.Linq.AsyncEnumerable
- IAsyncEnumerable<T>