ICorProfilerInfo2::GetCodeInfo2 Method

Gets the extents of native code associated with the specified FunctionID.


HRESULT GetCodeInfo2(  
    [in]  FunctionID functionID,  
    [in]  ULONG32 cCodeInfos,  
    [out] ULONG32 *pcCodeInfos,  
    [out, size_is(cCodeInfos), length_is(*pcCodeInfos)]  
    COR_PRF_CODE_INFO codeInfos[]);  


[in] The ID of the function with which the native code is associated.

[in] The size of the codeInfos array.

[out] A pointer to the total number of COR_PRF_CODE_INFO structures available.

[out] A caller-provided buffer. After the method returns, it contains an array of COR_PRF_CODE_INFO structures, each of which describes a block of native code.


The extents are sorted in order of increasing Microsoft intermediate language (MSIL) offset.

After GetCodeInfo2 returns, you must verify that the codeInfos buffer was large enough to contain all the COR_PRF_CODE_INFO structures. To do this, compare the value of cCodeInfos with the value of the cchName parameter. If cCodeInfos divided by the size of a COR_PRF_CODE_INFO structure is smaller than pcCodeInfos, allocate a larger codeInfos buffer, update cCodeInfos with the new, larger size, and call GetCodeInfo2 again.

Alternatively, you can first call GetCodeInfo2 with a zero-length codeInfos buffer to obtain the correct buffer size. You can then set the codeInfos buffer size to the value returned in pcCodeInfos, multiplied by the size of a COR_PRF_CODE_INFO structure, and call GetCodeInfo2 again.


Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 2.0

See Also

GetCodeInfo3 Method
ICorProfilerInfo2 Interface
Profiling Interfaces