-
Notifications
You must be signed in to change notification settings - Fork 781
Handle clashes in System.Interactive.Async with System.Linq.Asyncenumerable
#2280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle clashes in System.Interactive.Async with System.Linq.Asyncenumerable
#2280
Conversation
Having dealt with all the clashes in System.Linq.Async, it turns out that there are further methods in
We were picking up extra DLLs causing great confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request addresses compatibility issues between System.Interactive.Async and the new System.Linq.AsyncEnumerable that ships in .NET 10, with the primary goal of ensuring both libraries can coexist without conflicts.
Key Changes
- Added obsolete attributes to
Distinctmethods that are superseded byDistinctByinSystem.Linq.AsyncEnumerable - Introduced
MaxByWithTiesAsyncandMinByWithTiesAsyncto differentiate from the standard LINQ operators - Fixed reference assembly packaging to properly handle lib/ref mismatches across target frameworks
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Ix.NET/Source/refs/System.Interactive.Async/System.Interactive.Async.csproj |
New reference assembly project with conditional System.Linq.AsyncEnumerable dependency for non-net10.0 targets |
Ix.NET/Source/System.Interactive.Async/System.Interactive.Async.csproj |
Added reference assembly packaging and NuGet warning suppressions for intentional lib/ref mismatches |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Distinct.cs |
Marked projection-based Distinct overloads as obsolete, directing users to DistinctBy |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MinByWithTies.cs |
New file implementing MinByWithTiesAsync to avoid clash with standard LINQ MinByAsync |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MaxByWithTies.cs |
New file implementing MaxByWithTiesAsync to avoid clash with standard LINQ MaxByAsync |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MinBy.cs |
Moved ExtremaBy helper methods to MinByWithTies.cs and wrapped in !REFERENCE_ASSEMBLY directive |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/MaxBy.cs |
Wrapped in !REFERENCE_ASSEMBLY directive; implementation now shares helpers with MaxByWithTies.cs |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Min.cs |
Wrapped in !REFERENCE_ASSEMBLY directive to exclude from reference assembly |
Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Max.cs |
Wrapped in !REFERENCE_ASSEMBLY directive to exclude from reference assembly |
Ix.NET/Source/System.Linq.Async/System.Linq.Async.csproj |
Fixed reference assembly packaging path pattern |
Ix.NET/Source/System.Interactive/System.Interactive.csproj |
Fixed reference assembly packaging path pattern |
Ix.NET/Source/System.Interactive.Providers/System.Interactive.Providers.csproj |
Fixed reference assembly packaging path pattern |
Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs |
Added query provider overloads for AsAsyncEnumerable, AverageAsync, MinByWithTiesAsync, and MaxByWithTiesAsync |
Ix.NET/Source/System.Linq.Async.SourceGenerator/AsyncOverloadsGenerator.cs |
Fixed generator to skip empty groupings |
Ix.NET/Source/AsyncQueryableGenerator.t4 |
Added code to skip ToObservable method which cannot be represented in queries |
Ix.NET/Source/Playground/Playground.csproj |
Marked as non-packable |
Ix.NET/Source/FasterLinq/FasterLinq.csproj |
Marked as non-packable |
Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj |
Marked as non-packable |
Ix.NET/Source/ApiCompare/ApiCompare.csproj |
Marked as non-packable |
Ix.NET/Source/Ix.NET.sln |
Added reference assembly project to solution, updated Visual Studio version |
Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Api/ApiApprovalTests.SystemInteractiveAsync.verified.cs |
Updated API approval tests with obsolete attributes and new methods |
Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Api/ApiApprovalTests.SystemInteractiveAsyncProviders.verified.cs |
Updated API approval tests with new query provider methods |
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MinByWithTies.cs |
New test file for MinByWithTiesAsync |
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MaxByWithTies.cs |
New test file for MaxByWithTiesAsync |
Ix.NET/Documentation/adr/0002-System-Linq-Async-In-Net10.md |
Updated ADR with explanation of the clashes and resolution strategy |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and" + | ||
| " the functionality of selector-based overloads of Distinct now exists as Distinc" + | ||
| "tBy.")] | ||
| public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Func<TSource, System.Threading.Tasks.ValueTask<TKey>> keySelector) { } | ||
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and" + | ||
| " the functionality of selector-based overloads of Distinct now exists as Distinc" + | ||
| "tBy.")] | ||
| public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Func<TSource, TKey> keySelector) { } | ||
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and" + | ||
| " the functionality of selector-based overloads of Distinct now exists as Distinc" + | ||
| "tBy.")] |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'DistinctBy' (was split as 'Distinc' + 'tBy' due to line break).
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and" + | |
| " the functionality of selector-based overloads of Distinct now exists as Distinc" + | |
| "tBy.")] | |
| public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Func<TSource, System.Threading.Tasks.ValueTask<TKey>> keySelector) { } | |
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and" + | |
| " the functionality of selector-based overloads of Distinct now exists as Distinc" + | |
| "tBy.")] | |
| public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Func<TSource, TKey> keySelector) { } | |
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and" + | |
| " the functionality of selector-based overloads of Distinct now exists as Distinc" + | |
| "tBy.")] | |
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and the functionality of selector-based overloads of Distinct now exists as DistinctBy.")] | |
| public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Func<TSource, System.Threading.Tasks.ValueTask<TKey>> keySelector) { } | |
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and the functionality of selector-based overloads of Distinct now exists as DistinctBy.")] | |
| public static System.Collections.Generic.IAsyncEnumerable<TSource> Distinct<TSource, TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, System.Func<TSource, TKey> keySelector) { } | |
| [System.Obsolete("Use DistinctBy. IAsyncEnumerable LINQ is now in System.Linq.AsyncEnumerable, and the functionality of selector-based overloads of Distinct now exists as DistinctBy.")] |
Although the intent of
System.Interactive.Asyncis to contain non-standard LINQ operators, withSystem.Linq.Asynccontaining only standard ones, 'standard LINQ operators' is a somewhat nebulous concept. It turns out that since the original split betweenSystem.Interactive.AsyncandSystem.Linq.Asyncwas established,System.Linq.AsyncEnumerabledefines some methods that we had considered to be non-standard operators. (E.g.,System.Interactive.Asyncoffered projection-based forms ofDistinct. But these have been superseded by the new standardDistinctBy.)The result is that it turns out that in order to accommodate the arrival of
System.Linq.AsyncEnumerablein .NET 10 (available to downlevel runtimes via NuGet), it is necessary not only to updateSystem.Linq.Async(which we already did) but also to fixSystem.Interactive.Async.Also, it turned out we had some issues with how we were building ref assemblies, and this fixes that too.