Notifies the profiler that a function is about to return to the caller and provides information about the stack frame and function return value.
[in] The identifier of the function that is returning.
[in] The remapped function identifier, which the profiler previously specified via the FunctionIDMapper function.
[in] A COR_PRF_FRAME_INFO value that points to information about the stack frame.
The profiler should treat this as an opaque handle that can be passed back to the execution engine in the ICorProfilerInfo2::GetFunctionInfo2 method.
[in] A pointer to a COR_PRF_FUNCTION_ARGUMENT_RANGE structure that specifies the memory location of the function's return value.
In order to access return value information, the COR_PRF_ENABLE_FUNCTION_RETVAL flag must be set. The profiler can use the ICorProfilerInfo::SetEventMask method to set the event flags.
The values of the func and retvalRange parameters are not valid after the FunctionLeave2 function returns because the values may change or be destroyed.
The FunctionLeave2 function is a callback; you must implement it. The implementation must use the __declspec(naked) storage-class attribute.
The execution engine does not save any registers before calling this function.
On entry, you must save all registers that you use, including those in the floating-point unit (FPU).
On exit, you must restore the stack by popping off all the parameters that were pushed by its caller.
The implementation of FunctionLeave2 should not block because it will delay garbage collection. The implementation should not attempt a garbage collection because the stack may not be in a garbage collection-friendly state. If a garbage collection is attempted, the runtime will block until FunctionLeave2 returns.
Also, the FunctionLeave2 function must not call into managed code or in any way cause a managed memory allocation.
Platforms: See .NET Framework System Requirements.
.NET Framework Versions: Available since 2.0