System.ModuleHandle.ValidateModulePointer C# (CSharp) Méthode

ValidateModulePointer() private méthode

private ValidateModulePointer ( ) : void
Résultat void
        private void ValidateModulePointer()
        {
            // Make sure we have a valid Module to resolve against.
            if (IsNullHandle())
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NullModuleHandle"));
        }

Usage Example

Exemple #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);
                }
            }
        }
All Usage Examples Of System.ModuleHandle::ValidateModulePointer