ICorProfilerFunctionControl::SetILFunctionBody Method

Replaces the Common Intermediate Language (CIL) body of the method.


HRESULT SetILFunctionBody(  
    [in]  ULONG   cbNewILMethodHeader,  
    [in, size_is(cbNewILMethodHeader)] LPCBYTE pbNewILMethodHeader);  


[in] The total size of the new CIL, including the header and any structures that come after the body.

[in] A pointer to the new CIL header.

Return Value

This method returns the following specific HRESULTs.

HRESULT Description
S_OK The replacement was successful.


Unlike the ICorProfilerInfo::SetILFunctionBody method, the SetILFunctionBody method manages the memory required for the new CIL body. This means that the CIL body provided by the profiler does not have to be allocated by using the IMethodMalloc interface or allocated within a particular range. It can be allocated on any heap. The profiler can free the memory used for its CIL body after SetILFunctionBody returns.


Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 4.5

See also