Coffeehouse Post

Single Post Permalink

View Thread: Awesome, Debugger Canvas
  • User profile image

    this is not very difficult to do. In a visual studio addin you code an DebuggerEvents.OnEnterBreakMode event handler.

                _debugEvents = _applicationObject.Events.DebuggerEvents;
                _debugEvents.OnEnterBreakMode +=
                new _dispDebuggerEvents_OnEnterBreakModeEventHandler(BreakHandler);

    Your addin creates a ToolWindow that hosts a WPF user control ( which in turn contains a Canvas ).

    The OnEnterBreakMode event handler accesses the Debugger.CurrentStackFrame from the DTE2 application object:

          var sf = _applicationObject.Debugger.CurrentStackFrame;

    From the StackFrame you get a collection of Expression from the Arguments and Locals collections:

          foreach (var item in sf.Locals)
            if (item is EnvDTE.Expression)
              var exprItem = item as EnvDTE.Expression;

    Hooking up to the code on the call stack I assume is done with Project Roslyn.

    Working with the values of the variables is a bit limited in my experience. The Expression object.Value property only returns the ToString( ) contents of an object and its members.