/// <summary> /// Converts a type identifier to an <c>ICorDebugType</c> value. /// </summary> /// <param name="id"> /// The type identifier. /// </param> /// <param name="ppType"> /// A pointer to the address of an <c>ICorDebugType</c> object. /// </param> /// <remarks> /// In some cases, methods that return a type identifier may return a /// null <c>COR_TYPEID</c> value. If this value is passed as the <c>id</c> /// argument, the <c>GetTypeForTypeID</c> method will fail and return <c>E_FAIL</c>. /// </remarks> public int GetTypeForTypeID(COR_TYPEID id, out CorDebugType ppType) { void **ptr = default; int hResult = Calli(_this, This[0]->GetTypeForTypeID, id.ToCalliArg(), &ptr); ComFactory.Create(ptr, hResult, out ppType); return(hResult); }
/// <summary> /// Gets a pointer to a function that has a given signature. /// </summary> /// <param name="nTypeArgs"> /// The number of type arguments for the function. /// </param> /// <param name="typeArgs"> /// An array of pointers, each of which points to an <c>ICorDebugType</c> /// object that represents a type argument of the function. The /// first element is the return type; each of the other elements is /// a parameter type. /// </param> /// <param name="type"> /// A pointer to the address of an <c>ICorDebugType</c> object that /// represents the pointer to the function. /// </param> public int GetFunctionPointerType(ReadOnlySpan <CorDebugType> typeArgs, out CorDebugType type) { void **pType = default; using var pTypeArgs = NativeArray.AllocCom(typeArgs); int hResult = Calli(_this, This[0]->GetFunctionPointerType, typeArgs.Length, pTypeArgs, &pType); ComFactory.Create(pType, hResult, out type); return(hResult); }
/// <summary> /// Gets the type declaration for this class. /// </summary> /// <param name="elementType"> /// A value of the CorElementType enumeration that specifies the element /// type for this class: Set this value to <c>ELEMENT_TYPE_VALUETYPE</c> /// if this <c>ICorDebugClass2</c> represents a value type. Set this value /// to <c>ELEMENT_TYPE_CLASS</c> if this <c>ICorDebugClass2</c> represents /// a complex type. /// </param> /// <param name="nTypeArgs"> /// The number of type parameters, if the type is generic. The number of type /// parameters (if any) must match the number required by the class. /// </param> /// <param name="typeArgs"> /// An array of pointers, each of which points to an <c>ICorDebugType</c> object /// that represents a type parameter. If the class is non-generic, this value is null. /// </param> /// <param name="type"> /// A pointer to the address of an <c>ICorDebugType</c> object that represents the /// type declaration. This object is equivalent to a <c>System.Type</c> object in /// managed code. /// </param> /// <remarks> /// If the class is non-generic, that is, if it has no type parameters, /// <c>GetParameterizedType</c> simply gets the runtime type object corresponding /// to the class. The <c>elementType</c> parameter should be set to the correct /// element type for the class: <c>ELEMENT_TYPE_VALUETYPE</c> if the class is a /// value type; otherwise, <c>ELEMENT_TYPE_CLASS</c>. /// /// If the class accepts type parameters (for example, <c>ArrayList<T></c>), /// you can use <c>GetParameterizedType</c> to construct a type object for an /// instantiated type such as <c>ArrayList<int></c>. /// </remarks> public int GetParameterizedType( CorElementType elementType, ReadOnlySpan <CorDebugType> typeArgs, out CorDebugType type) { void **pType = default; using var pTypeArgs = NativeArray.AllocCom(typeArgs); int hResult = Calli( _this, This[0]->GetParameterizedType, (uint)elementType, typeArgs.Length, pTypeArgs, &pType); ComFactory.Create(pType, hResult, out type); return(hResult); }
/// <summary> /// Gets an array of the specified type, or a pointer or reference /// to the specified type. /// </summary> /// <param name="elementType"> /// A value of the <c>CorElementType</c> enumeration that specifies the /// underlying native type (an array, pointer, or reference) to be created. /// </param> /// <param name="nRank"> /// The rank (that is, number of dimensions) of the array. This value must /// be <c>0</c> if <c>elementType</c> specifies a pointer or reference type. /// </param> /// <param name="typeArg"> /// A pointer to an <c>ICorDebugType</c> object that represents the type of array, /// pointer, or reference to be created. /// </param> /// <param name="type"> /// A pointer to the address of an <c>ICorDebugType</c> object that represents /// the constructed array, pointer type, or reference type. /// </param> /// <remarks> /// The value of elementType must be one of the following: /// /// - <c>ELEMENT_TYPE_PTR</c> /// - <c>ELEMENT_TYPE_BYREF</c> /// - <c>ELEMENT_TYPE_ARRAY</c> or <c>ELEMENT_TYPE_SZARRAY</c> /// /// If the value of elementType is <c>ELEMENT_TYPE_PTR</c> or <c>ELEMENT_TYPE_BYREF</c>, /// <c>nRank</c> must be zero. /// </remarks> public int GetArrayOrPointerType( CorElementType elementType, int nRank, CorDebugType typeArg, out CorDebugType type) { void **pType = default; using var pTypeArg = typeArg?.AcquirePointer(); int hResult = Calli( _this, This[0]->GetArrayOrPointerType, (uint)elementType, nRank, pTypeArg, &pType); ComFactory.Create(pType, hResult, out type); return(hResult); }
/// <summary> /// Gets the base type, if one exists, of the type represented /// by this type. /// </summary> /// <remarks> /// Looking up the base type for a type is useful to implement common /// debugger functionality, such as printing out all the fields of an /// object or its parent classes. /// </remarks> public int GetBase(out CorDebugType @base) => InvokeGetObject(_this, This[0]->GetBase, out @base);
/// <summary> /// Gets the first Type parameter of the type represented by /// this type. /// </summary> /// <remarks> /// This method can be called in cases where the additional /// information about the type involves, at most, one type parameter. /// In particular, it can be used if the type is an <see cref="CorElementType.ELEMENT_TYPE_ARRAY" />, /// <see cref="CorElementType.ELEMENT_TYPE_SZARRAY" />, <see cref="CorElementType.ELEMENT_TYPE_BYREF" />, /// or <see cref="CorElementType.ELEMENT_TYPE_PTR" />, as indicated by the /// <see cref="GetType(out CorElementType)" /> method. /// </remarks> public int GetFirstTypeParameter(out CorDebugType value) => InvokeGetObject(_this, This[0]->GetFirstTypeParameter, out value);