GetMetadataImport() private method

private GetMetadataImport ( ) : MetadataImport
return System.Reflection.MetadataImport
コード例 #1
0
        internal unsafe static IRuntimeFieldInfo ResolveFieldHandleInternal(RuntimeModule module, int fieldToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
        {
            ModuleHandle.ValidateModulePointer(module);
            if (!ModuleHandle.GetMetadataImport(module.GetNativeHandle()).IsValidToken(fieldToken))
            {
                throw new ArgumentOutOfRangeException("metadataToken", Environment.GetResourceString("Argument_InvalidToken", new object[]
                {
                    fieldToken,
                    new ModuleHandle(module)
                }));
            }
            int typeInstCount;

            IntPtr[] array = RuntimeTypeHandle.CopyRuntimeTypeHandles(typeInstantiationContext, out typeInstCount);
            int      methodInstCount;

            IntPtr[] array2 = RuntimeTypeHandle.CopyRuntimeTypeHandles(methodInstantiationContext, out methodInstCount);
            fixed(IntPtr *ptr = array)
            {
                fixed(IntPtr *ptr2 = array2)
                {
                    IRuntimeFieldInfo result = null;

                    ModuleHandle.ResolveField(module.GetNativeHandle(), fieldToken, ptr, typeInstCount, ptr2, methodInstCount, JitHelpers.GetObjectHandleOnStack <IRuntimeFieldInfo>(ref result));
                    GC.KeepAlive(typeInstantiationContext);
                    GC.KeepAlive(methodInstantiationContext);
                    return(result);
                }
            }
        }
コード例 #2
0
        internal static unsafe RuntimeType ResolveTypeHandleInternal(RuntimeModule module, int typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
        {
            ModuleHandle.ValidateModulePointer(module);
            if (!ModuleHandle.GetMetadataImport(module).IsValidToken(typeToken))
            {
                throw new ArgumentOutOfRangeException("metadataToken", Environment.GetResourceString("Argument_InvalidToken", (object)typeToken, (object)new ModuleHandle(module)));
            }
            int length1;

            IntPtr[] numArray1 = RuntimeTypeHandle.CopyRuntimeTypeHandles(typeInstantiationContext, out length1);
            int      length2;

            IntPtr[] numArray2 = RuntimeTypeHandle.CopyRuntimeTypeHandles(methodInstantiationContext, out length2);
            IntPtr[] numArray3 = numArray1;
            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            // ISSUE: explicit reference operation
            fixed(IntPtr *typeInstArgs = & ^ (numArray1 == null || numArray3.Length == 0 ? (IntPtr&)IntPtr.Zero : @numArray3[0]))
            fixed(IntPtr * methodInstArgs = numArray2)
            {
                RuntimeType o = (RuntimeType)null;

                ModuleHandle.ResolveType(module, typeToken, typeInstArgs, length1, methodInstArgs, length2, JitHelpers.GetObjectHandleOnStack <RuntimeType>(ref o));
                GC.KeepAlive((object)typeInstantiationContext);
                GC.KeepAlive((object)methodInstantiationContext);
                return(o);
            }
        }
コード例 #3
0
 internal static unsafe RuntimeMethodHandleInternal ResolveMethodHandleInternalCore(RuntimeModule module, int methodToken, IntPtr[] typeInstantiationContext, int typeInstCount, IntPtr[] methodInstantiationContext, int methodInstCount)
 {
     ModuleHandle.ValidateModulePointer(module);
     if (!ModuleHandle.GetMetadataImport(module.GetNativeHandle()).IsValidToken(methodToken))
     {
         throw new ArgumentOutOfRangeException("metadataToken", Environment.GetResourceString("Argument_InvalidToken", (object)methodToken, (object)new ModuleHandle(module)));
         fixed(IntPtr *typeInstArgs = typeInstantiationContext)
         fixed(IntPtr * methodInstArgs = methodInstantiationContext)
         return(ModuleHandle.ResolveMethod(module.GetNativeHandle(), methodToken, typeInstArgs, typeInstCount, methodInstArgs, methodInstCount));
 }
コード例 #4
0
        internal unsafe static RuntimeMethodHandleInternal ResolveMethodHandleInternalCore(RuntimeModule module, int methodToken, IntPtr[] typeInstantiationContext, int typeInstCount, IntPtr[] methodInstantiationContext, int methodInstCount)
        {
            ModuleHandle.ValidateModulePointer(module);
            if (!ModuleHandle.GetMetadataImport(module.GetNativeHandle()).IsValidToken(methodToken))
            {
                throw new ArgumentOutOfRangeException("metadataToken", Environment.GetResourceString("Argument_InvalidToken", new object[]
                {
                    methodToken,
                    new ModuleHandle(module)
                }));
            }

            fixed(IntPtr *ptr = typeInstantiationContext)
            {
                fixed(IntPtr *ptr2 = methodInstantiationContext)
                {
                    return(ModuleHandle.ResolveMethod(module.GetNativeHandle(), methodToken, ptr, typeInstCount, ptr2, methodInstCount));
                }
            }
        }
コード例 #5
0
        internal static unsafe IRuntimeFieldInfo ResolveFieldHandleInternal(RuntimeModule module, int fieldToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
        {
            ModuleHandle.ValidateModulePointer(module);
            if (!ModuleHandle.GetMetadataImport(module.GetNativeHandle()).IsValidToken(fieldToken))
                throw new ArgumentOutOfRangeException("metadataToken", Environment.GetResourceString("Argument_InvalidToken", (object)fieldToken, (object)new ModuleHandle(module)));
}