Visual Studio 包 - 如何获取本地窗口中的信息?
我有一个 VSPackage,我想在调试模式下获取与本地窗口中显示的信息类似的信息(当前上下文的变量值)。
我一直在尝试 DTE.Debugger.CurrentStackFrame 实例,它看起来很有趣,因为它公开了 Argument 和本地表达式集合。但是,我看不到将表达式的值作为对象获取的方法 - Value 属性似乎只是 ToString 值。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不可能将值作为对象来获取。主要是因为该值与您的 VS 包不存在于同一进程中。它存在于被调试进程中。 Visual Studio 调试器必须通过 CLR API 来操作该值。您能做的最好的事情就是从 VS 包中获取字符串值。
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.
您可以使用 Visual Studio Visualizer 访问实际对象。可以在此处找到该信息。
You can get access to actual objects using a Visual Studio Visualizer. The info can be found here.