Stop eagerly loading methods/members via reflection which aren't necessarily needed #27113
Labels
area-aot
area-perf
area-query
consider-for-current-release
punted-for-7.0
Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints.
type-enhancement
Milestone
In many translators, we currently eagerly load MethodInfos and MemberInfos via reflection at static construction, and then do a reference comparison to match against them. #26288 changes the loading to be compatible with trimming, but this still means that all these methods/members never get trimmed regardless whether the user application actually needs them or not.
We can switch to matching methods by name, possibly by using a string switch which also verifies parameters. This would avoid the linker dependency on these things, and allow trimming them if not used by the user. Note that we should do this on a case-by-case basis; method translators should probably use this, whereas EnumerableMethods/QueryableMethods can probably stay as they are.
In addition, this may speed up our startup time as less reflection lookups will be performed.
Suggested by @ajcvickers
The text was updated successfully, but these errors were encountered: