Search code examples
c#debuggingvs-extensibilityvspackage

Visual Studio Package - How can I get hold of the information in the locals window?


I have a VSPackage that I would like to get information similar to that shown in the locals window when in debug mode (the values of variables for the current context).

I have been experimenting with the DTE.Debugger.CurrentStackFrame instance which looked interesting because it exposed Argument and Local collections of expressions. However, I can't see a way of getting the value of an expression as an object - the Value property just seems to be the ToString value.


Solution

  • It is not possible to get ahold of the value as an object. Mainly because the value doesn't exist in the same process as your VS Package. It exists in the debugee process. The Visual Studio Debugger has to go through the CLR API's to manipulate the value. The best you can do is get ahold of the string value from the VS Package.