Notifies the profiler that the just-in-time (JIT) compiler has started to compile a function.
It is possible to receive more than one pair of JITCompilationStarted and ICorProfilerCallback::JITCompilationFinished calls for each function because of the way the runtime handles class constructors. For example, the runtime starts to JIT-compile method A, but the class constructor for class B needs to be run. Therefore, the runtime JIT-compiles the constructor for class B and runs it. While the constructor is running, it makes a call to method A, which causes method A to be JIT-compiled again. In this scenario, the first JIT compilation of method A is halted. However, both attempts to JIT-compile method A are reported with JIT-compilation events. If the profiler is going to replace Microsoft intermediate language (MSIL) code for method A by calling the ICorProfilerInfo::SetILFunctionBody method, it must do so for both JITCompilationStarted events, but it may use the same MSIL block for both.
Profilers must support the sequence of JIT callbacks in cases where two threads are simultaneously making callbacks. For example, thread A calls JITCompilationStarted. However, before thread A calls JITCompilationFinished, thread B calls ICorProfilerCallback::ExceptionSearchFunctionEnter with the function ID from thread A's JITCompilationStarted callback. It might appear that the function ID should not yet be valid because a call to JITCompilationFinished had not yet been received by the profiler. However, in a case like this one, the function ID is valid.
Platforms: See .NET Framework System Requirements.
Header: CorProf.idl, CorProf.h
.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0