The profiler receives a method but does not receive a FunctionEnter callback for the same method (310828)



The information in this article applies to:

  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ .NET (2002)
  • 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++)
  {
      <create_domain and unwrap an object obj>
      obj::get_iiAge();
      <unload domain>
  }
}
				

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.

REFERENCES

For additional information related to CLR profiling, click the article number below to view the article in the Microsoft Knowledge Base:

309551 INFO: CLR Profiling Services Problems

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

312220 PRB: Function Passed to UnmanagedToManagedTransition Callback Is Not JIT-Compiled


Modification Type:MajorLast Reviewed:12/31/2005
Keywords:kbtshoot kbPerformanceTool kbprb KB310828 kbAudDeveloper