Description
This is a follow-up on #111544
I've since tested to see whether the delegate fix was enough to remove the rooting of __GetFieldHelper across the affected structs (thanks for doing that work @MichalStrehovsky). Unfortunately it's not, there is a large quantity of them that get their type taken which seems to force __GetFieldHelper to be kept again.
The type is taken by a user defined TypedReference, until the BCL variant is modernized (see #45152 (comment)). After modernization I could use the BCL variant, but it would cause the same rooting.
I really only need the type handle for later validation during AsRef, could we perhaps recognize typeof(T).TypeHandle
or typeof(T).TypeHandle.Value
as not causing T to become reflectable?
The reason I'm so adamant about this is that __GetFieldHelper generally doubles the size of these small structs in the binary. This creates an unfortunate design trade-off for small structs and classes: get binary bloat or runtime allocations.
Metadata
Metadata
Assignees
Type
Projects
Status