Skip to content

Commit df83502

Browse files
Cam Soperstephentoub
andauthored
System.Linq.AsyncEnumerable breaking change in .NET 10 (#44989)
* Switched to new defintion, revised tables * lint * fix table * wip * Update docs/core/compatibility/core-libraries/10.0/asyncenumerable.md Co-authored-by: Stephen Toub <[email protected]> * Feedback and ToC --------- Co-authored-by: Stephen Toub <[email protected]>
1 parent 5ffd99f commit df83502

File tree

3 files changed

+62
-7
lines changed

3 files changed

+62
-7
lines changed

docs/core/compatibility/10.0.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
1919
## Core .NET libraries
2020

2121
| Title | Type of change | Introduced version |
22-
|----------------------------------------------------------------------------------------------------------------------------|---------------------|--------------------|
23-
| [API obsoletions with non-default diagnostic IDs](core-libraries/10.0/obsolete-apis.md) | Source incompatible | Preview 1 |
24-
| [ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change](core-libraries/10.0/activity-sampling.md) | Behavioral change | Preview 1 |
25-
| [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 |
26-
| [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 |
27-
| [LDAP DirectoryControl parsing is now more stringent](core-libraries/10.0/ldap-directorycontrol-parsing.md) | Behavioral change | Preview 1 |
28-
| [MacCatalyst version normalization](core-libraries/10.0/maccatalyst-version-normalization.md) | Behavioral change | Preview 1 |
22+
| ---------------------------------------------------------------------------------------------------------------------------- | --------------------- | -------------------- |
23+
|------------------------------------------------------------------------------------------------------------------------------|-----------------------|----------------------|
24+
| [ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change](core-libraries/10.0/activity-sampling.md) | Behavioral change | Preview 1 |
25+
| [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 |
26+
| [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 |
27+
| [LDAP DirectoryControl parsing is now more stringent](core-libraries/10.0/ldap-directorycontrol-parsing.md) | Behavioral change | Preview 1 |
28+
| [MacCatalyst version normalization](core-libraries/10.0/maccatalyst-version-normalization.md) | Behavioral change | Preview 1 |
29+
| [System.Linq.AsyncEnumerable included in core libraries](core-libraries/10.0/asyncenumerable.md) | Source incompatible | Preview 1 |
2930

3031
## Globalization
3132

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "Breaking change - System.Linq.AsyncEnumerable in .NET 10"
3+
description: "Learn about the breaking change in .NET 10 where the AsyncEnumerable class is now included."
4+
ms.date: 2/21/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/44886
7+
---
8+
9+
# System.Linq.AsyncEnumerable in .NET 10
10+
11+
.NET 10 introduces the `AsyncEnumerable` class, which provides a full set of LINQ extension methods for the <xref:System.Collections.Generic.IAsyncEnumerable`1> type. This class replaces the community-maintained `System.Linq.Async` NuGet library, potentially causing compilation errors due to ambiguities.
12+
13+
## Version introduced
14+
15+
.NET 10 Preview 1
16+
17+
## Previous behavior
18+
19+
The `AsyncEnumerable` class in the `System.Linq.Async` package provided LINQ support for <xref:System.Collections.Generic.IAsyncEnumerable`1>.
20+
21+
## New behavior
22+
23+
The `AsyncEnumerable` class in .NET 10, as well as in the `System.Linq.AsyncEnumerable` NuGet package, provides LINQ support for <xref:System.Collections.Generic.IAsyncEnumerable`1>.
24+
25+
## Type of breaking change
26+
27+
This is a [source incompatible](../../categories.md#source-compatibility) change.
28+
29+
## Reason for change
30+
31+
<xref:System.Collections.Generic.IAsyncEnumerable`1> 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.
32+
33+
## Recommended action
34+
35+
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.
36+
37+
If `System.Linq.Async` is consumed indirectly via another package, avoid ambiguity errors by including this in the project:
38+
39+
```xml
40+
<PackageReference Include="System.Linq.Async" Version="6.0.1">
41+
<ExcludeAssets>all</ExcludeAssets>
42+
</PackageReference>
43+
```
44+
45+
Most consuming code will not need changes, but some call sites might need updates to refer to newer names and signatures.
46+
47+
## Affected APIs
48+
49+
- `System.Linq.AsyncEnumerable`
50+
- <xref:System.Collections.Generic.IAsyncEnumerable`1>

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ items:
2222
href: core-libraries/10.0/ldap-directorycontrol-parsing.md
2323
- name: MacCatalyst version normalization
2424
href: core-libraries/10.0/maccatalyst-version-normalization.md
25+
- name: System.Linq.AsyncEnumerable included in core libraries
26+
href: core-libraries/10.0/asyncenumerable.md
2527
- name: Cryptography
2628
items:
2729
- name: X500DistinguishedName validation is stricter
@@ -1352,6 +1354,8 @@ items:
13521354
href: core-libraries/10.0/ldap-directorycontrol-parsing.md
13531355
- name: MacCatalyst version normalization
13541356
href: core-libraries/10.0/maccatalyst-version-normalization.md
1357+
- name: System.Linq.AsyncEnumerable included in core libraries
1358+
href: core-libraries/10.0/asyncenumerable.md
13551359
- name: .NET 9
13561360
items:
13571361
- name: Adding a ZipArchiveEntry sets header general-purpose bit flags

0 commit comments

Comments
 (0)