locked
IDebugModuleLoadEvent2 event is never triggered by my debug engine RRS feed

  • Question

  • Hi,

    Problem statement: "I don't get the module load event callback from my debug engine".

    In a nutshell, the first VSPackage that has my debug engine, uses the IDebugEventCallback2.Event [1] to notify the SDM

    that something happened, e.g. "A module was loaded".

    The second VSPackage listens to debug events (from all DEs), and wants to do something when a module load event occurs on that debug engine.

    But this second VSPackage never receives the module load event.

    Details

    I've forked the Microsoft MIEngine project from GitHub [2],

    and I did some minor changes to customize the debug engine to my needs (nothing really important).

    Now,

    From a different VSPackage, e.g. MyVsPackage, I have the following code:

    // Subscribe to debug events callbacks from the debug engine.

    //

    IVsDebugger2 debugger;

    debugger = GetGlobalService(typeof(SVsShellDebugger)) as IVsDebugger2;

    var result = ((IVsDebugger)debugger).AdviseDebugEventCallback(myCallbackObj);

    // Callback implementation

    //

    class MyCallbackObj : IDebugEventCallback2

    {

            int IDebugEventCallback2.Event(IDebugEngine2 pEngine, IDebugProcess2 pProcess,
                                           IDebugProgram2 pProgram, IDebugThread2 pThread,
                                           IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib)

    {

                const string AD7ModuleLoadEvent_IID = "989db083-0d7c-40d1-a9d9-921bf611a4b2";

                string engineName = "";
                Guid engineGuid;

                 // Is it a module loaded event?

                 //

                 if (riidEvent.ToString().ToLower() == AD7ModuleLoadEvent_IID)

                 {

                            // Do something

                            //

                 }

    }

    }

    The problem is that I never enter the "if" block of the module loaded with my debug engine guid.

    All notifications come from the native debug engine.

    Any idea why?

    My guess is that I'm missing some AD7 metric, or smth like that.

    Thanks,

    Ofir

    [1] https://msdn.microsoft.com/en-us/library/bb162146.aspx

    [2] https://github.com/Microsoft/MIEngine


    • Edited by Ofir Cohen Sunday, November 15, 2015 4:29 PM
    Sunday, November 15, 2015 4:18 PM

Answers

  • What interop assembly is your code compiled against? You want to be using Microsoft.VisualStudio.Debugger.InteropA.dll, and not Microsoft.VisualStudio.Debugger.Interop.dll

    Visual Studio Debugger Dev

    • Marked as answer by Ofir Cohen Tuesday, November 17, 2015 4:01 PM
    Monday, November 16, 2015 6:46 PM

All replies

  • What interop assembly is your code compiled against? You want to be using Microsoft.VisualStudio.Debugger.InteropA.dll, and not Microsoft.VisualStudio.Debugger.Interop.dll

    Visual Studio Debugger Dev

    • Marked as answer by Ofir Cohen Tuesday, November 17, 2015 4:01 PM
    Monday, November 16, 2015 6:46 PM
  • Thank you so much,

    that was indeed the issue :-)!

    Tuesday, November 17, 2015 4:02 PM