Add polyfill for Task.WhenEach(...)#46
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a polyfill for the Task.WhenEach(...) method introduced in .NET 9.0, enabling developers to iterate over tasks as they complete using async enumeration. The implementation provides both generic and non-generic variants, with support for cancellation tokens.
Key changes:
- Polyfill implementation for
Task.WhenEach()with four method overloads (generic and non-generic, params array and IEnumerable) - Comprehensive test coverage demonstrating the async enumeration behavior
- Updated documentation to reflect the new polyfilled signatures
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| PolyShim/Signatures.md | Updated member counts and added documentation links for the four new Task.WhenEach overloads |
| PolyShim/Net90/Task.cs | New polyfill implementation providing async enumerable iteration over completing tasks, conditionally compiled for platforms before .NET 9.0 that support async interfaces |
| PolyShim.Tests/Net90/TaskTests.cs | Added test cases verifying correct task completion ordering for both generic and non-generic variants |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
PolyShim/Signatures.md:277
- The documented signature includes a
CancellationTokenparameter, but the actual implementation inPolyShim/Net90/Task.csdoes not include this overload. Either the implementation should be added or this line should be corrected to match the actual signature:IAsyncEnumerable<Task<T>> WhenEach(IEnumerable<Task<T>>)
- [`Task<T?> FromResult<T>(T?)`](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task.fromresult) <sup><sub>.NET Core 1.0</sub></sup>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.