.Net Profiler - JIT Compilation Callbacks not called in .Net Version 2.0 RRS feed

  • Question

  • The profiler is getting registered and i am getting the ModuleLoadStarted and ModuleLoadFinished Callbacks in my profiler code. But For the same modules the JITCompilationStarted and any other JIT related functions are not getting called. 

    I am not getting the callbacks for any System.* classes and methods which are in version 2.0 modules. 

    But if i change the Application Pool version to 4.0 then i am getting the JIT callbacks to my profiler for the same web application and in the same machine.

    What i am missing for the Version 2.0 and 32 Bit machine ? 


    • Edited by Selva VS Thursday, May 5, 2016 1:21 PM
    Thursday, May 5, 2016 1:13 PM


  • Just to clarify, are you saying that you get JIT callbacks for .NET 2 assemblies when running in a .NET 4 environment but not when running in a .NET 2 environment? what assemblies are they? are they ngened?

    Ngened images are (mostly) compiled ahead of time rather than by the JIT, and so don't generated JIT callbacks. but IIRC, using an ngened image requires that you are using the same version of assemblies it was compiled against. Your .NET 2 assembly wast probably ngened against the .NET 2 version of mscorlib and your .NET 4 environment would be using the .NET 4 version of mscorlib, which means it needs to JIT rather than use the ngened image and so you get your callbacs.

    .NET 4 introduced the COR_PRF_DISABLE_ALL_NGEN_IMAGES flag to disable the use of ngened images, but in .NET 2 you need to either uninstall the ngened images or have the profiler request ngened images with profiler support and hope that none where installed (COR_PRF_USE_PROFILE_IMAGES).

    • Marked as answer by Selva VS Monday, May 9, 2016 4:49 AM
    Thursday, May 5, 2016 10:04 PM