How do I use EnvDTE to get the current line in the debugger, when the debugger is stepping through disassembly?

Nicole Demera 1 Reputation point

Okay, so I have a VSIX project where I am attempting to programmatically control the step into debug function and then get the line that is going to be executed next as a string. I have been able to successfully do this with the following code for debugging c# but not for the disassembly window:

//Executes step into as though use pressed the button on the toolbar
public static void StepInto(DTE dte)
     Debugger debugger = (Debugger)dte.Debugger;

//Returns a string that contains the current line of code in the debugger (Doesn't work on dissasembly)
private string GetCurrentLine(DTE dte)
     string currentline;

     //Throws exception here because the var activePoint is null 
     //and then when assigning currentline there is a null reference
     var activePoint = ((TextSelection)dte.ActiveDocument.Selection).ActivePoint;
     currentline = activePoint.CreateEditPoint().GetLines(activePoint.Line, activePoint.Line + 1);

     return currentline;

The problem is that the active document does not represent the disassembly window, at least that's my best guess. The entire point of this project is to step through assembly and I cannot for the life of me figure out how to do what I want. Is there a way to get the current line in the disassembly window?

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,408 questions
{count} votes