Skip to content

fix(polyfills): optimize PolySharp to only generate needed types#4

Merged
j-d-ha merged 1 commit into
mainfrom
fix/only-pollyfill-needed-code
Dec 19, 2025
Merged

fix(polyfills): optimize PolySharp to only generate needed types#4
j-d-ha merged 1 commit into
mainfrom
fix/only-pollyfill-needed-code

Conversation

@j-d-ha

@j-d-ha j-d-ha commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

🚀 Pull Request

📋 Summary

This PR optimizes the PolySharp configuration to only generate the specific polyfill types that are actually needed by the project, rather than generating all available types. This reduces build output size and improves build performance.

Changes Made

  • Added PolySharpIncludeGeneratedTypes property to specify only the required types:
    • System.Index
    • System.Range
    • System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute
    • System.Diagnostics.CodeAnalysis.NotNullWhenAttribute

This ensures we only polyfill what's necessary for compatibility across different .NET versions while keeping the generated code minimal.

✅ Checklist

  • Changes build cleanly
  • Tests added/updated (if applicable)
  • Documentation or README updated (if needed)
  • Coding style compliance
  • Local testing completed (where applicable)

🧪 Related Issues or PRs

N/A

💬 Notes for Reviewers

This change is purely an optimization - it doesn't affect functionality but reduces the amount of code PolySharp generates. The selected types are the ones actually used in the codebase based on analysis of the source code needs.

…generated types

- Added `PolySharpIncludeGeneratedTypes` property in `.csproj` to generate specific attributes and types
  (e.g., `System.Index`, `System.Range`, etc.).
@j-d-ha
j-d-ha merged commit af7c0e5 into main Dec 19, 2025
1 check passed
@j-d-ha
j-d-ha deleted the fix/only-pollyfill-needed-code branch December 19, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant