.Net Profiler - CLR calls only IID_ICorProfilerCallback2 RRS feed

  • Question

  • I have inherited ICorProfilerCallback6 in to my profiler for using GetAssemblyReferences(..) method. 

    Whenever my web application runs and the w3wp processes tries to load the profiler, the CreateObject of my profiler is receiving the riid of IID_ICorProfilerCallback2. Even if i run a web application compiled in v4.6.1 or whatever, the RIID that comes for the CreateObject is IID_ICorProfilerCallback2 only. 

    In this scenario how can i typecast Callback6 to the interface..?. 

    *ppInterface = static_cast<ICorProfilerCallback6 *>(pProfilerCallback);

    If i blindly cast ICorProfilerCallback6, it throws error in event logs as IID_ICorProfilerCallback2 is expected. But QueryInterface of my profiler class is getting riid of callback6 after two times of callback2. I am totally confused how to implement callback6's methods.. How should i proceed with this? 


    Wednesday, September 12, 2018 10:36 AM

All replies

  • Hi Selva VS,

    Since your question is more related to web, you could post a new thread in ASP.NET forum for suitable support.


    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 13, 2018 5:50 AM
  • The question is about the profiler api provided by the runtime, the "web application" aspect is largely tangential and really only provides context to the question.
    Thursday, September 13, 2018 8:55 AM
  • Hi Brian,

    I had used the SetEventMast2 from ICorProfilerInfo5 and appropriate event mask for GetAssemblyReferences(..) method of ICorProfilerCallback6. 

    Now in Azure environment on using "COR_PRF_USE_PROFILE_IMAGES" the profiler makes w3wp.exe to crash during execution of injected function call(function definition in seperate HelperAssembly). 

    But without using the flag in event mask, the profiler gets loaded but the modules that get loaded ends with .ni.dll. System.dll as System.ni.dll , System.Xml.dll as System.Xml.ni.dll. And JITCompilationStarted has not got any of the functions in System.* classes. 

    How can i achieve this without making *.ni.dll to get loaded? and with COR_PRF_USE_PROFILE_IMAGES? Is there any possibility to get in touch with you in a dedicated Chat session?



    Monday, September 17, 2018 4:51 AM
  • I believe the .ni.dll modules are the ngened images.

    By the sounds of things, my guess would be that there is a problem with the IL being generated and things only work when you omit COR_PRF_USE_PROFILE_IMAGES because it's not generating the offending IL.

    Tuesday, October 30, 2018 8:53 PM