简体   繁体   English

Visual Studio包 - 如何在本地窗口中获取信息?

[英]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). 我有一个VSPackage,我希望在调试模式下获取类似于本地窗口中显示的信息(当前上下文的变量值)。

I have been experimenting with the DTE.Debugger.CurrentStackFrame instance which looked interesting because it exposed Argument and Local collections of expressions. 我一直在试验DTE.Debugger.CurrentStackFrame实例,它看起来很有趣,因为它暴露了Argument和Local表达式集合。 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. 但是,我无法看到将表达式的值作为对象获取的方法 - Value属性似乎只是ToString值。

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. 主要是因为该值与VS Package在同一进程中不存在。 It exists in the debugee process. 它存在于debugee过程中。 The Visual Studio Debugger has to go through the CLR API's to manipulate the value. Visual Studio调试器必须通过CLR API来操作值。 The best you can do is get ahold of the string value from the VS Package. 您可以做的最好的事情是从VS包中获取字符串值。

You can get access to actual objects using a Visual Studio Visualizer. 您可以使用Visual Studio Visualizer访问实际对象。 The info can be found here . 信息可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Locals窗口为空(Visual Studio 2015) - Locals window empty (Visual Studio 2015) Visual Studio 2010 Locals Window 红色字体 - Visual Studio 2010 Locals Window Red Font Visual Studio 2015本地窗口中没有本地变量 - Visual Studio 2015 no local variables in locals window 可以将Visual Studio 2015本地/监视/自动窗口配置为像以前的版本一样反映继承吗? - Can Visual Studio 2015 locals/watch/auto window be configured to reflect inheritance like previous versions did? 如何以编程方式获取有关其他解决方案的信息或进行操作? (Visual Studio,C#) - How can I programmatically get information about or manipulate another solution? (Visual Studio, C#) 在 Visual Studio 2017 上没有本地人 window - Don't have Locals window on Visual Studio 2017 通过代码扩展Visual Studio Locals / Autos窗口 - Extend the Visual Studio Locals/Autos window through code 如何将按钮添加到Visual Studio扩展的窗口? - How can I add a button to a window for a Visual Studio Extension? 如何在visual studio的即时窗口中运行foreach循环? - How can I run a foreach loop in the immediate window of visual studio? 如何轻松地从Visual Studio即时窗口收集信息 - How do I easily Collection information from the Visual Studio immediate window
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM