Skip to content

Replace shared PolyfillExtensions partial class with unique per-file extension classes#75

Merged
Tyrrrz merged 4 commits intomasterfrom
copilot/refactor-member-polyfills-naming
Feb 16, 2026
Merged

Replace shared PolyfillExtensions partial class with unique per-file extension classes#75
Tyrrrz merged 4 commits intomasterfrom
copilot/refactor-member-polyfills-naming

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 16, 2026

Plan: Replace PolyfillExtensions with Unique Extension Classes

  • Understand current structure and choose naming convention
  • Update all .cs files to use unique class names based on file path
  • Remove PolyfillExtensions.cs file (no longer needed)
  • Update List-Signatures.ps1 to skip the new unique class names
  • Build successfully with new changes
  • Run tests to ensure functionality is maintained (246/252 passed, 6 failures are environmental)
  • Address code review feedback
  • Run security checks (0 issues found)
  • Remove redundant using directives (21 files cleaned up)

Summary

Successfully refactored all member polyfill extension classes and cleaned up redundant using directives.

Latest Changes:

  • Removed redundant using System.Diagnostics.CodeAnalysis; from 21 attribute definition files
  • These files declare types within the System.Diagnostics.CodeAnalysis namespace, so they don't need to import it
Original prompt

Currently, we use one class called PolyfillExtensions for all member polyfills. This is proving to be cumbersome.

Let's instead name each extensions class uniquely. Perhaps MemberPolyfills_(random sequence). Feel free to suggest a more efficient naming convention.

Each class therefore needs to be excluded from coverage. And none of them needs to be partial.

The signatures PowerShell script may need to be updated too.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 16, 2026 18:09
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
@Tyrrrz Tyrrrz added the enhancement New feature or request label Feb 16, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review February 16, 2026 18:12
Copilot AI review requested due to automatic review settings February 16, 2026 18:12
Copilot AI changed the title [WIP] Refactor member polyfills classes to unique names Replace shared PolyfillExtensions partial class with unique per-file extension classes Feb 16, 2026
Copilot AI requested a review from Tyrrrz February 16, 2026 18:14
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 refactors the polyfill extension mechanism by replacing a single shared PolyfillExtensions partial class (with numbered variants) with unique, individually named extension classes following the pattern MemberPolyfills_{Version}_{Type}. This improves code organization and eliminates the need for multiple partial class definitions.

Changes:

  • Replaced all PolyfillExtensions, PolyfillExtensions2, and PolyfillExtensions3 partial classes with 98 uniquely named MemberPolyfills_* classes
  • Added [ExcludeFromCodeCoverage] attribute and using System.Diagnostics.CodeAnalysis; to all polyfill extension classes
  • Updated PowerShell signature generation script to filter new class naming pattern
  • Removed the now-obsolete PolyfillExtensions.cs file

Reviewed changes

Copilot reviewed 117 out of 117 changed files in this pull request and generated no comments.

File Description
PolyShim/PolyfillExtensions.cs Removed obsolete partial class definitions that are no longer needed
PolyShim/List-Signatures.ps1 Updated regex pattern to skip new MemberPolyfills_* classes in signature generation
PolyShim/Net*/*.cs (98 files) Renamed extension classes from PolyfillExtensions* to MemberPolyfills_{Version}_{Type}, added [ExcludeFromCodeCoverage] attribute and required using directive, removed partial modifier
PolyShim/NetCore*/*.cs (attribute files) Added using System.Diagnostics.CodeAnalysis; directive to attribute definition files for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Feb 16, 2026

@copilot remove redundant using directives

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot remove redundant using directives

Removed redundant using System.Diagnostics.CodeAnalysis; from 21 attribute definition files that declare types within that namespace. Commit: 2c78284

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:

  • example.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/PolyShim/PolyShim/PolyShim.Tests/bin/Release/net10.0/PolyShim.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/PolyShim/PolyShim/PolyShim.Tests/bin/Release/net10.0/PolyShim.Tests.deps.json /home/REDACTED/work/PolyShim/PolyShim/PolyShim.Tests/bin/Release/net10.0/testhost.dll --port 34411 --endpoint 127.0.0.1:034411 --role client --parentprocessid 4235 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants