public IntPtrConstructorMethodInvoker(MetadataReader reader, MethodHandle methodHandle) { // Since we control the definition of System.IntPtr, we only do enough analysis of the signature to disambiguate the constructors we support. _id = IntPtrConstructorId.None; Method method = methodHandle.GetMethod(reader); HandleCollection parameterTypeSignatureHandles = method.Signature.GetMethodSignature(reader).Parameters; if (parameterTypeSignatureHandles.Count == 1) { HandleCollection.Enumerator enumerator = parameterTypeSignatureHandles.GetEnumerator(); enumerator.MoveNext(); Handle parameterTypeHandle = enumerator.Current; // If any parameter is a pointer type, bail as we don't support Invokes on pointers. if (parameterTypeHandle.HandleType != HandleType.TypeDefinition) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_PointerArguments); } TypeDefinition typeDefinition = parameterTypeHandle.ToTypeDefinitionHandle(reader).GetTypeDefinition(reader); String name = typeDefinition.Name.GetString(reader); switch (name) { case "Int32": _id = IntPtrConstructorId.Int32; break; case "Int64": _id = IntPtrConstructorId.Int64; break; case "UInt32": _id = IntPtrConstructorId.UInt32; break; case "UInt64": _id = IntPtrConstructorId.UInt64; break; default: break; } } }