Conversation
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
…`Stack` Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
… (.NET 7.0) Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
…prove EnsureCapacity docs Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c66d552a-bdf5-404e-b0cc-b714a7a1e32a
|
@copilot rename the PR title, replace the number of sections with the number of new APIs, and also highlight major namespaces |
Counted 49 new APIs total across four namespaces:
Suggested title: "Add 49 polyfills across System, System.Collections.Generic, System.IO, and System.Linq" Unfortunately the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Adds a new batch of PolyShim polyfills to backport newer BCL APIs (NET 5–9 era) onto older TFMs, along with corresponding unit tests in PolyShim.Tests.
Changes:
- Added new polyfills across multiple TFMs (e.g.,
Stack<T>.TryPeek/TryPop,EnsureCapacitystubs,Path.Exists, newTimeSpanfactories, span-basedRandomoverloads, and span-basedTryParseoverloads). - Added/updated tests to validate the added polyfills across the test target frameworks.
- Expanded
ConvertandFilepolyfills with span/memory overloads for hex and append operations.
Reviewed changes
Copilot reviewed 48 out of 48 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| PolyShim/NetCore20/Stack.cs | Adds Stack<T>.TryPeek / TryPop polyfills for older TFMs. |
| PolyShim/Net90/TimeSpan.cs | Adds .NET 9-style TimeSpan long-based factory overloads. |
| PolyShim/Net90/File.cs | Adds File.AppendAllBytes span/memory overload polyfills. |
| PolyShim/Net90/Convert.cs | Adds Convert.ToHexStringLower(ReadOnlySpan<byte>) polyfill. |
| PolyShim/Net80/Random.cs | Adds Random.GetItems span overloads and Shuffle(Span<T>). |
| PolyShim/Net80/ObjectDisposedException.cs | Adds ObjectDisposedException.ThrowIf polyfills. |
| PolyShim/Net80/ArgumentOutOfRangeException.cs | Adds ArgumentOutOfRangeException.ThrowIf* helper polyfills. |
| PolyShim/Net70/Byte.cs | Adds byte.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/Int16.cs | Adds short.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/Int32.cs | Adds int.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/Int64.cs | Adds long.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/SByte.cs | Adds sbyte.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/UInt16.cs | Adds ushort.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/UInt32.cs | Adds uint.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/UInt64.cs | Adds ulong.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/Single.cs | Adds float.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/Double.cs | Adds double.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/Decimal.cs | Adds decimal.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/IntPtr.cs | Adds IntPtr.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/UIntPtr.cs | Adds UIntPtr.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/DateTime.cs | Adds DateTime.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/DateTimeOffset.cs | Adds DateTimeOffset.TryParse(ReadOnlySpan<char>, ...) polyfill. |
| PolyShim/Net70/TimeSpan.cs | Adds TimeSpan.FromMicroseconds(double) polyfill. |
| PolyShim/Net70/Path.cs | Adds Path.Exists(string?) polyfill (file/dir existence). |
| PolyShim/Net60/Stack.cs | Adds Stack<T>.EnsureCapacity(int) stub polyfill. |
| PolyShim/Net60/Queue.cs | Adds Queue<T>.EnsureCapacity(int) stub polyfill. |
| PolyShim/Net60/HashSet.cs | Adds HashSet<T>.EnsureCapacity(int) stub polyfill. |
| PolyShim/Net60/EnumerableExtensions.cs | Adds 3-sequence Enumerable.Zip polyfill. |
| PolyShim/Net50/String.cs | Adds string.IndexOf(char, StringComparison) polyfill. |
| PolyShim/Net50/Dictionary.cs | Adds Dictionary<TKey,TValue>.EnsureCapacity(int) stub polyfill. |
| PolyShim/Net50/Convert.cs | Adds span overloads for hex encode/decode polyfills. |
| PolyShim.Tests/NetCore20/StackTests.cs | Tests Stack<T>.TryPeek / TryPop. |
| PolyShim.Tests/Net90/TimeSpanTests.cs | Tests the new TimeSpan factory overloads. |
| PolyShim.Tests/Net90/FileTests.cs | Tests AppendAllBytes array/span and async array/memory overloads. |
| PolyShim.Tests/Net90/ConvertTests.cs | Tests ToHexStringLower array/span overloads. |
| PolyShim.Tests/Net80/RandomTests.cs | Tests Random.GetItems span overloads and Shuffle(Span<T>). |
| PolyShim.Tests/Net80/ObjectDisposedExceptionTests.cs | Tests ObjectDisposedException.ThrowIf overloads. |
| PolyShim.Tests/Net80/ArgumentOutOfRangeExceptionTests.cs | Tests ArgumentOutOfRangeException.ThrowIf* helpers. |
| PolyShim.Tests/Net70/TimeSpanTests.cs | Tests TimeSpan.FromMicroseconds. |
| PolyShim.Tests/Net70/PathTests.cs | Tests Path.Exists behavior for file/dir/null/empty. |
| PolyShim.Tests/Net70/NumericTryParseSpanTests.cs | Tests TryParse(ReadOnlySpan<char>, ...) polyfills across numeric/date pointer types. |
| PolyShim.Tests/Net60/StackTests.cs | Tests Stack<T>.EnsureCapacity stub behavior. |
| PolyShim.Tests/Net60/QueueTests.cs | Tests Queue<T>.EnsureCapacity stub behavior. |
| PolyShim.Tests/Net60/HashSetTests.cs | Tests HashSet<T>.EnsureCapacity stub behavior. |
| PolyShim.Tests/Net60/EnumerableExtensionsTests.cs | Tests 3-sequence Zip polyfill behavior. |
| PolyShim.Tests/Net50/StringTests.cs | Tests string.IndexOf(char, StringComparison) polyfill. |
| PolyShim.Tests/Net50/DictionaryTests.cs | Tests Dictionary<TKey,TValue>.EnsureCapacity stub behavior. |
| PolyShim.Tests/Net50/ConvertTests.cs | Tests span/string overloads for hex encode/decode polyfills. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot can you identify why the build is failing? |
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/2dbe3380-ee64-4405-9997-94647c7ea5cf
The build fails on Fixed in c2abeb1 by adding Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot the new build is failing too |
…ETFRAMEWORK guards for span tests Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/c3af6596-645e-4ae2-96ea-6ab894a48b86
The build was crashing because commit Fixed in 2b1651a by:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot build no longer crashing but the tests are failing |
…iseconds(0.5) which rounds on net462 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Agent-Logs-Url: https://github.com/Tyrrrz/PolyShim/sessions/47c6c53b-a628-46cd-a630-feea931231e7
Fixed in 617d1f3. The
The test failure was in |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## prime #91 +/- ##
==========================================
+ Coverage 85.48% 87.32% +1.84%
==========================================
Files 220 255 +35
Lines 3630 4135 +505
Branches 315 345 +30
==========================================
+ Hits 3103 3611 +508
+ Misses 456 455 -1
+ Partials 71 69 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 63 out of 63 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds 49 missing polyfill APIs across four major namespaces, identified from analysis of the existing codebase. Each group adds related polyfills and corresponding tests.
Changes
System—ArgumentOutOfRangeExceptionthrow helpers (.NET 8.0)ThrowIfNegative<T>,ThrowIfNegativeOrZero<T>,ThrowIfZero<T>(usingIComparable<T>constraint)ThrowIfGreaterThan<T>,ThrowIfGreaterThanOrEqual<T>,ThrowIfLessThan<T>,ThrowIfLessThanOrEqual<T>ThrowIfEqual<T>,ThrowIfNotEqual<T>System—ObjectDisposedException.ThrowIf(.NET 8.0)ThrowIf(bool, object)andThrowIf(bool, Type)System—RandomSpan overloads (.NET 8.0)GetItems<T>(ReadOnlySpan<T>, int),GetItems<T>(ReadOnlySpan<T>, Span<T>),Shuffle<T>(Span<T>)System—ConvertSpan overloads (.NET 5.0 / .NET 9.0)FromHexString(ReadOnlySpan<char>),ToHexString(ReadOnlySpan<byte>)(.NET 5.0)ToHexStringLower(ReadOnlySpan<byte>)(.NET 9.0)System—TimeSpanfactory overloads (.NET 7.0 / .NET 9.0)TimeSpan.FromMicroseconds(double)(.NET 7.0)TimeSpan.FromSeconds(long, ...),FromMinutes(long, ...),FromHours(long, ...),FromDays(long, ...)(.NET 9.0)System—string.IndexOf(char, StringComparison)(.NET 5.0)Contains(char, StringComparison)polyfillSystem— NumericTryParse(ReadOnlySpan<char>, IFormatProvider?, out T)(.NET 7.0)TryParse(string, IFormatProvider?, out T)polyfills:byte,short,int,long,sbyte,ushort,uint,ulong,float,double,decimal,IntPtr,UIntPtrDateTimeandDateTimeOffsetSystem.Collections.Generic—Stack<T>.TryPeek/TryPop(.NET Core 2.0)Queue<T>.TryDequeue/TryPeekpolyfillSystem.Collections.Generic—EnsureCapacity(.NET 5.0 / .NET 6.0)Dictionary<TKey,TValue>.EnsureCapacity(int)(.NET 5.0)HashSet<T>.EnsureCapacity(int),Queue<T>.EnsureCapacity(int),Stack<T>.EnsureCapacity(int)(.NET 6.0)Capacityon older frameworksSystem.IO—Path.Exists(.NET 7.0)bool Path.Exists(string?)— implemented asFile.Exists || Directory.ExistsSystem.IO—File.AppendAllBytesSpan/Memory overloads (.NET 9.0)AppendAllBytes(string, ReadOnlySpan<byte>)andAppendAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken)System.Linq—Enumerable.Zip3-sequence overload (.NET 6.0)IEnumerable<(TFirst, TSecond, TThird)> Zip<TFirst, TSecond, TThird>(IEnumerable<TSecond>, IEnumerable<TThird>)Security Summary
No security vulnerabilities were identified or introduced by these changes (confirmed by CodeQL scan).
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.