Skip to content
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

Stop using GetRequired* reflection wrappers to enable trimming #27099

Merged
merged 5 commits into from
Jan 8, 2022

Conversation

roji
Copy link
Member

@roji roji commented Jan 3, 2022

This removes GetRequiredRuntimeMethod and similar wrappers (introduced during NRT annotation), since these are opaque to the linker when performing static analysis for trimming; the reflection APIs are called directly instead.

A console program is included as a regression test - to test it, execute dotnet publish -c Release -r linux-x64 --self-contained under test/EFCore.Trimming.Test and then attempt to run EFCore.Trimming.Test from the publish directory.

Assuming we want to add this to our CI pipeline, @smitpatel where would be the right place to add it? Just an additional step e.g. under Linux in azure-pipelines.yml?

Note #27098 which provides a hacky but much smaller fix for 6.0.

Fixes #26288

@smitpatel
Copy link
Contributor

If it is not a test project, I would recommend updating azure-pipelines.yml to add additional step which runs this console app. You can also create batch file or sh file to build run it (so yml file will have single command invocation)

@roji roji force-pushed the GetRequiredRuntimeStuff branch 6 times, most recently from 799e204 to 8bd58b8 Compare January 5, 2022 14:20
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.

When looking up methods via reflection, be trimming/AOT-friendly
3 participants