Skip to content

Stop eagerly loading methods/members via reflection which aren't necessarily needed #27113

@roji

Description

@roji

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

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions