Skip to content

Do not preserve enumerators in reflection #117345

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

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

huoyaoyuan
Copy link
Member

@huoyaoyuan huoyaoyuan commented Jul 6, 2025

This single line will cause all enumerators to be preserved when reflection is used, for every generic instantiation of every collection type.

Although user application may still introduce this, at least it saves for simpler applications.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 6, 2025
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@huoyaoyuan huoyaoyuan changed the title Do not preserve enumerators Do not preserve enumerators in reflection Jul 6, 2025
@huoyaoyuan
Copy link
Member Author

MichalStrehovsky/rt-sz#142 (comment)

Saves 8KB in reflection. Not change in other workloads, as they have either using IEnumerable or not using reflection.

@jkotas
Copy link
Member

jkotas commented Jul 7, 2025

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jkotas jkotas merged commit 83e4e28 into dotnet:main Jul 7, 2025
115 of 124 checks passed
@huoyaoyuan huoyaoyuan deleted the enumerator-box branch July 7, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants