Preserve the System.RuntimeType constructor in mono ILLink (#48710)
authorTanner Gooding <tagoo@outlook.com>
Thu, 25 Feb 2021 00:05:36 +0000 (16:05 -0800)
committerGitHub <noreply@github.com>
Thu, 25 Feb 2021 00:05:36 +0000 (16:05 -0800)
* Preserve the System.RuntimeType constructor in mono ILLink

* Update src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml

* Update src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml

index ce6945b..a327adb 100644 (file)
                <type fullname="System.RuntimeMethodHandle" preserve="fields" />
 
                <!-- domain.c: mono_defaults.runtimetype_class -->
-               <!-- under mono, this has no runtime visible fields -->
-               <type fullname="System.RuntimeType" preserve="nothing" />
+               <!-- under mono, this has no runtime visible fields but the constructor can be called from unmanaged code in mono_type_get_object_checked -->
+               <!-- RuntimeType is a fundamental type and the constructor is called by the runtime to implement reflection primitives like Object.GetType() and typeof(C) -->
+               <type fullname="System.RuntimeType">
+                       <method signature="System.Void .ctor()" />
+               </type>
 
                <!-- domain.c: mono_defaults.typehandle_class -->
                <type fullname="System.RuntimeTypeHandle" preserve="fields" />