.NET Core comes with the IsReferenceOrContainsReferences<T> JIT intrinsic which infers from the given type whether the type is a managed reference type or contains managed references in one of its fields. It is mainly used to infer whether a type needs to be GC-tracked and finalized. This value is inferred during the type layout pass when building a method table at runtime.
Currently AsmResolver does not have an equivalent way for ITypeDescriptors.
Problem Description
.NET Core comes with the
IsReferenceOrContainsReferences<T>
JIT intrinsic which infers from the given type whether the type is a managed reference type or contains managed references in one of its fields. It is mainly used to infer whether a type needs to be GC-tracked and finalized. This value is inferred during the type layout pass when building a method table at runtime.Currently AsmResolver does not have an equivalent way for
ITypeDescriptor
s.Proposal
Add a
ReferenceOrContainsReferences
flag to the MemoryLayoutAttributes enum.Alternatives
We could add a property or extension method to
ITypeDescriptor
directly, however this would require its own full pass on the entire type.Additional Context