Conversation
….)`, `TextWriter.DisposeAsync(...)`
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds polyfills for the DisposeAsync() method to Stream, TextReader, and TextWriter classes, enabling asynchronous disposal for platforms that don't natively support these methods (pre-.NET Core 3.0). The implementations check for native IAsyncDisposable support when available and fall back to wrapping synchronous Dispose() calls in Task.Run().
Key changes:
- Added
DisposeAsync()polyfill implementations for Stream, TextReader, and TextWriter classes - Updated documentation to reflect the addition of 4 new member signatures (3 DisposeAsync methods + Task.Yield)
- Applied appropriate conditional compilation directives to target platforms lacking native support
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| PolyShim/Signatures.md | Updated signature counts and added documentation entries for new DisposeAsync() methods and Task.Yield() |
| PolyShim/NetCore30/Stream.cs | Implemented DisposeAsync() polyfill for Stream with fallback logic |
| PolyShim/NetCore30/TextReader.cs | Implemented DisposeAsync() polyfill for TextReader with fallback logic |
| PolyShim/NetCore30/TextWriter.cs | Implemented DisposeAsync() polyfill for TextWriter with fallback logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Stream.DiposeAsync(), TextReader.DisposeAsync(...), TextWriter.DisposeAsync(...)Stream.DisposeAsync(), TextReader.DisposeAsync(...), TextWriter.DisposeAsync(...)
This was referenced Jan 1, 2026
This was referenced Feb 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.