Microsoft KB Archive/310828

= The profiler receives a method but does not receive a FunctionEnter callback for the same method =

Article ID: 310828

Article Last Modified on 12/31/2005

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition
 * Microsoft .NET Framework 1.0

-



This article was previously published under Q310828



SYMPTOMS
There may be times when the profiler receives a just-in-time (JIT) compilation event for a method but does not receive a FunctionEnter callback for the same method.



CAUSE
This scenario can arise when a method is executed from a context-bound object. Common Language Runtime (CLR) Remoting currently does not recognize that the method could be executed in a difference context. So the method is always JIT-complied for the current context as well as for the remoting contexts. The JIT-complied method for the current context may never be entered. As a result, the FunctionEnter callback will not be called.



STATUS
This behavior is by design.



MORE INFORMATION
The following pseudocode may help illustrate this problem.

FAgeCalc::getFactorialAge { for(int i=0 i< 3; i++) {      obj::get_iiAge; } }

The profiler receives the following notifications:

TID: 0x0013fbe0 JITTED: Method: FAgeCalc.FAgeCalc::get_iiAge(0x0eba57c8)

NOTE: This method was never entered.

TID: 0x0013fbe0 JITTED: Method: AgeCalc.FAgeCalc::get_iiAge(0x15d76dc0)

TID: 0x0013fbe0 Entered: Method: FAgeCalc.FAgeCalc::get_iiAge(0x15d76dc0)

TID: 0x0013fbe0 JITTED: Method: FAgeCalc.FAgeCalc::get_iiAge(0x102a6d70)

TID: 0x0013fbe0 Entered: Method: FAgeCalc.FAgeCalc::get_iiAge(0x102a6d70)

TID: 0x0013fbe0 JITTED: Method: FAgeCalc.FAgeCalc::get_iiAge(0x102a6d70)

TID: 0x0013fbe0 Entered: Method: FAgeCalc.FAgeCalc::get_iiAge(0x102a6d70)

It makes sense that you receive multiple JIT-compilation events and FunctionEnter events for each appdomain because the object is context-bound. However, the first JIT-compilation event is corresponding to the method JIT-complied for the context in the default domain. Because the method is never executed in the default domain, it is never entered, and the profiler does not receive a FunctionEnter callback.

