FunctionEnter Function

Notifies the profiler that control is being passed to a function.


The FunctionEnter function is deprecated in the .NET Framework version 2.0, and its use will incur a performance penalty. Use the FunctionEnter2 function instead.

void __stdcall FunctionEnter (
    [in]  FunctionID funcID


  • funcID
    [in] The identifier of the function to which control is passed.


The FunctionEnter 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 FunctionEnter 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 FunctionEnter returns.

Also, the FunctionEnter function must not call into managed code or in any way cause a managed memory allocation.


Platforms: See .NET Framework System Requirements.

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Versions: 1.1, 1.0

See Also


FunctionEnter2 Function

FunctionLeave2 Function

FunctionTailcall2 Function

ICorProfilerInfo2::SetEnterLeaveFunctionHooks2 Method

Other Resources

Profiling Global Static Functions