-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add polyfills for Span<T>, Memory<T>, ArrayPool<T>, MemoryPool<T>, and related types
#64
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
Conversation
…<T>`, and all auxillary types
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 PR adds comprehensive polyfills for memory-related types (Span<T>, Memory<T>, ReadOnlySpan<T>, ReadOnlyMemory<T>, ArrayPool<T>, MemoryPool<T>, MemoryMarshal, MemoryExtensions, and StandardFormat) to enable modern .NET APIs on older frameworks. The PR also removes signature-compatible array-based replacements in favor of proper Span/Memory implementations and modernizes test code with collection expressions.
Key changes:
- Implements core memory types with array-backed storage for older framework compatibility
- Removes temporary array-based method signatures in favor of proper Span/Memory overloads
- Updates documentation examples to demonstrate async enumerable usage instead of memory APIs
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| Readme.md | Updates example code to showcase async enumerable features; updates package versions |
| PolyShim/Signatures.md | Documents new memory-related types and extension methods; updates total signature counts |
| PolyShim/NetCore21/Span.cs | New polyfill providing Span<T> with array-backed storage |
| PolyShim/NetCore21/ReadOnlySpan.cs | New polyfill providing ReadOnlySpan<T> with array-backed storage |
| PolyShim/NetCore21/Memory.cs | New polyfill providing Memory<T> wrapper around arrays |
| PolyShim/NetCore21/ReadOnlyMemory.cs | New polyfill providing ReadOnlyMemory<T> wrapper around arrays |
| PolyShim/NetCore21/MemoryExtensions.cs | New extension methods for arrays, spans, and strings to enable memory operations |
| PolyShim/NetCore21/MemoryMarshal.cs | New utility class for low-level memory operations |
| PolyShim/NetCore21/MemoryPool.cs | New polyfill for MemoryPool<T> with simple non-pooling implementation |
| PolyShim/NetCore21/StandardFormat.cs | New struct for standard formatting specifications |
| PolyShim/NetCore21/IMemoryOwner.cs | New interface for memory ownership pattern |
| PolyShim/NetCore10/ArrayPool.cs | New polyfill for ArrayPool<T> with simple non-pooling implementation |
| PolyShim/NetCore21/StreamWriter.cs | Removes conditional compilation guards now that memory types are always available |
| PolyShim/NetCore21/StreamReader.cs | Removes array-based signature-compatible methods, keeps only Span/Memory versions |
| PolyShim/NetCore21/Stream.cs | Removes array-based signature-compatible methods, keeps only Span/Memory versions |
| PolyShim/NetCore21/Random.cs | Removes conditional compilation guards for memory-dependent methods |
| PolyShim/Net70/Stream.cs | Removes array-based signature-compatible methods for read operations |
| PolyShim/Net100/Random.cs | Removes array-based GetString method, delegates to Span version |
| PolyShim.Tests/PolyShim.Tests.csproj | Removes explicit System.Memory and System.ValueTuple package references |
| PolyShim.Tests/NetCore21/*.cs | Renames test methods and modernizes with collection expression syntax |
| PolyShim.Tests/Net70/StreamTests.cs | Modernizes test assertions with collection expression syntax |
| PolyShim.Tests/Net90/FileTests.cs | Modernizes test code with collection expression syntax |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…add-span-memory-polyfills
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
Copilot reviewed 25 out of 25 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Span<T>, Memory<T>, ArrayPool<T>, MemoryPool<T>, and all auxillary typesSpan<T>, Memory<T>, ArrayPool<T>, MemoryPool<T>, and all auxiliary types
Co-authored-by: Copilot <[email protected]>
…add-span-memory-polyfills # Conflicts: # PolyShim/NetCore21/StandardFormat.cs
Span<T>, Memory<T>, ArrayPool<T>, MemoryPool<T>, and all auxiliary typesSpan<T>, Memory<T>, ArrayPool<T>, MemoryPool<T>, and related types
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
Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 29 out of 29 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.