You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Ix.NET/Documentation/adr/0002-System-Linq-Async-In-Net10.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,20 +36,23 @@ A further complication is that some methods in `System.Interactive.Async` clash
36
36
37
37
One more important point to consider is that although LINQ to `IAsyncEnumerable<T>` _mostly_ consists of extension methods, there are a few static methods. (E.g., `AsyncEnumerable.Range`, which the .NET library implements, and `AsyncEnumerable.Create`, which it does not.) With extension methods, the compiler does not have a problem with multiple identically-named types in different assemblies all defining extension methods as long as the individual methods do not conflict. However, non-extension methods are a problem. If `System.Linq.Async` were to continue to define a public `AsyncEnumerable` type, then calls to `AsyncEnumerable.Range` would fail to compile: even though there would only be a single `Range` method (supplied by the new `System.Linq.AsyncEnumerable`) this would fail to compile because `AsyncEnumerable` itself is an ambiguous class name. So it will be necessary for the public API of `System.Linq.Async` v7 not to define an `AsyncEnumerable` type. This places some limits on how far we can go with source-level compatibility. (Binary compatibility is not a problem because the runtime assemblies can continue to define this type.)
38
38
39
+
Since that constraint requires us to define a new type to hold all the obsolete extension methods (which we'll be calling `AsyncEnumerableDeprecated`) this creates a new problem: the runtime API needs to continue to provide all these methods as members of `AsyncEnumerable` (to provide binary compatibility) but any code newly compiled against Ix.NET v7 that is continuing to use these deprecated method (and which is therefore tolerating or suppressing the deprecation warning) will now end up building code that expects these methods to be in the `AsyncEnumerableDeprecated` class. We therefore need to provide all these methods in the runtime assemblies _twice_: once for binary compatibility as members of `AsyncEnumerable` (a class we completely hide at build time) and again as members of `AsyncEnumerableDeprecated` (the class we add to provide source-level backwards compatibility for code using the deprecated methods, in a way that doesn't cause ambiguous type name errors).
40
+
39
41
40
42
## Decision
41
43
42
44
The next Ix.NET release will:
43
45
44
46
1. add a reference to `System.Linq.AsyncEnumerable` and `System.Interactive.Async` in `System.Linq.Async`
45
47
2. remove from `System.Linq.Async`'s and `System.Interactive.Async`'s publicly visible API (ref assemblies) all `IAsyncEnumerable<T>` extension methods for which direct replacements exist (adding `MinByWithTiesAsync` and `MaxByWithTiesAsync` for the case where the new .NET runtime library methods actually have slightly different functionality)
46
-
4. Rename `AsyncEnumerable` to `AsyncEnumerableDeprecated` in the public API (reference assemblies; the old name will be retained in runtime assemblies for binary compatibility) to avoid errors arising from there being two definitions of `AsyncEnumerable` in the same namespace
47
-
5. add [Obsolete] attribute for members of `AsyncEnumerableDeprecated` for which `System.Linq.AsyncEnumerable` offers replacements that require code changes to use (e.g., `WhereAwait`, which is replaced by an overload of `Where`)
48
-
6. the `AsyncEnumerable.ToEnumerable` method that was a bad idea and that should probably have never existed has been marked as `Obsolete` and will not be replaced; note that although `ToObservable` has issues that meant the .NET team decided not to replicate it, the main issue is that it embeds opinions, and not that there's anything fundamentally broken about it, so we do not include `ToObservable` in this category
49
-
7. remaining methods of `AsyncEnumerable` (where `System.Linq.AsyncEnumerable` offers no equivalent) are removed from the publicly visible API of `System.Linq.Async`, with identical replacements being defined by `AsyncEnumerableEx` in `System.Interactive.Async`
50
-
8. mark `IAsyncGrouping` as obsolete
51
-
9. mark the public `IAsyncIListProvider` as obsolete, and define a non-public version for continued internal use in `System.Interactive.Linq`
52
-
10. continue to provide the full `System.Linq.Async` API in the `lib` assemblies to provide binary compatibility
48
+
3. Rename `AsyncEnumerable` to `AsyncEnumerableDeprecated` in the public API (reference assemblies; the old name will be retained in runtime assemblies for binary compatibility) to avoid errors arising from there being two definitions of `AsyncEnumerable` in the same namespace
49
+
4. add [Obsolete] attribute for members of `AsyncEnumerableDeprecated` for which `System.Linq.AsyncEnumerable` offers replacements that require code changes to use (e.g., `WhereAwait`, which is replaced by an overload of `Where`)
50
+
5. the `AsyncEnumerable.ToEnumerable` method that was a bad idea and that should probably have never existed has been marked as `Obsolete` and will not be replaced; note that although `ToObservable` has issues that meant the .NET team decided not to replicate it, the main issue is that it embeds opinions, and not that there's anything fundamentally broken about it, so we do not include `ToObservable` in this category
51
+
6. remaining methods of `AsyncEnumerable` (where `System.Linq.AsyncEnumerable` offers no equivalent) are removed from the publicly visible API of `System.Linq.Async`, with identical replacements being defined by `AsyncEnumerableEx` in `System.Interactive.Async`
52
+
7. mark `IAsyncGrouping` as obsolete
53
+
8. mark the public `IAsyncIListProvider` as obsolete, and define a non-public version for continued internal use in `System.Interactive.Linq`
54
+
9. continue to provide the full `System.Linq.Async` API in the `lib` assemblies to provide binary compatibility
55
+
10. in the runtime `System.Linq.Async` assembly provide a facade that duplicates the legacy `AsyncEnumerable` methods on an `AsyncEnumerableDeprecated` type so that code that builds against `System.Linq.Async` v7, and which chooses to continue to use methods marked as `[Obsolete]`, will find those methods at runtime
53
56
11. mark the `System.Linq.Async` NuGet package as obsolete, and recommend the use of `System.Linq.AsyncEnumerable` and/or `System.Interactive.Async` instead
54
57
55
58
The main effect of this is that code that had been using the `System.Linq.Async` implementation of LINQ for `IAsyncEnumerable<T>` will, in most cases, now be using the .NET runtime library implementation if it is rebuilt against this new version of `System.Linq.Async`.
Copy file name to clipboardExpand all lines: Ix.NET/Source/Playground/Program.cs
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// See the LICENSE file in the project root for more information.
4
4
5
5
#pragma warning disable IDE0051// Remove unused private members - all used via reflection
6
+
#pragma warning disable CS0618// Type or member is obsolete - this has not been updated since the deprecation of System.Linq.Async due to .NET 10's System.Linq.AsyncEnumerable
0 commit comments