ICorProfilerInfo::GetILFunctionBody Method

Gets a pointer to the body of a method in Microsoft intermediate language (MSIL) code, starting at its header.

HRESULT GetILFunctionBody(
    [in]  ModuleID    moduleId,
    [in]  mdMethodDef methodId,
    [out] LPCBYTE     *ppMethodHeader,
    [out] ULONG       *pcbMethodSize);

Parameters

  • moduleId
    [in] The ID of the module in which the function resides.

  • methodId
    [in] The metadata token for the method.

  • ppMethodHeader
    [out] A pointer to the method's header.

  • pcbMethodSize
    [out] An integer that specifies the size of the method.

Remarks

A method is scoped by the module in which it lives. Because the GetILFunctionBody method is designed to give a tool access to the MSIL code before it has been loaded by the common language runtime (CLR), it uses the metadata token of the method to find the desired instance.

GetILFunctionBody can return a CORPROF_E_FUNCTION_NOT_IL HRESULT if the methodId points to a method without any MSIL code (such as an abstract method, or a platform invoke (PInvoke) method).

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