Share via


ICorProfilerInfo2::GetClassIDInfo2 Method

Gets the parent module and metadata token of the specified generic class, the ClassID of its parent class, and the ClassID for each type argument, if present, of the class.

HRESULT GetClassIDInfo2(
    [in]  ClassID classId,
    [out] ModuleID *pModuleId,
    [out] mdTypeDef *pTypeDefToken,
    [out] ClassID *pParentClassId,
    [in]  ULONG32 cNumTypeArgs,
    [out] ULONG32 *pcNumTypeArgs,
    [out] ClassID typeArgs[]);

Parameters

  • classId
    [in] The ID of the class for which information will be retrieved.

  • pModuleId
    [out] Pointer to the ID of the parent module of the class.

  • pTypeDefToken
    [out] Pointer to the metadata token for the class.

  • pParentClassId
    [out] Pointer to the ID of the parent class.

  • cNumTypeArgs
    [in] The size of the typeArgs array.

  • pcNumTypeArgs
    [out] Pointer to the total number of available elements.

  • typeArgs
    [out] An array of ClassID values, each of which represents the ID of a type argument of the class. When the method returns, typeArgs will contain some or all the available ClassID values.

Remarks

The GetClassIDInfo2 method is similar to the ICorProfilerInfo::GetClassIDInfo method, but GetClassIDInfo2 obtains additional information about a generic type.

The profiler code can call ICorProfilerInfo::GetModuleMetaData to obtain a metadata interface for a given module. The metadata token that is returned to the location referenced by pTypeDefToken can then be used to access the metadata for the class.

After GetClassIDInfo2 returns, you must verify that the typeArgs buffer was large enough to contain all the ClassID values. To do this, compare the value that pcNumTypeArgs points to with the value of the cNumTypeArgs parameter. If pcNumTypeArgs points to a value that is larger than cNumTypeArgs, allocate a larger typeArgs buffer, update cNumTypeArgs with the new, larger size, and call GetClassIDInfo2 again.

Alternatively, you can first call GetClassIDInfo2 with a zero-length typeArgs buffer to obtain the correct buffer size. You can then set the typeArgs buffer size to the value returned in pcNumTypeArgs and call GetClassIDInfo2 again.

For more information about these two approaches, see Profiling API Method Conventions.

Requirements

Platforms: See .NET Framework System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0

See Also

Reference

ICorProfilerInfo Interface

ICorProfilerInfo2 Interface

Other Resources

Profiling Interfaces

Profiling (Unmanaged API Reference)