调试器可视化工具不工作? 难道我注册错了?
我在 VS2008 中创建了一个调试器可视化工具。 我在同一个 .dll 中创建了两个类:-
- BinaryDataDebuggerVisualizer
- ImageDebuggerVisualizer
图像类工作正常(例如,放大镜出现在调试模式下),但不适用于 byte[] 类 (BinaryDataDV)。 我的可视化工具所做的是将二进制数据显示为模式窗口中的图像(如果数据是合法图像)。 我在发布模式下编译为代码,然后将 .dll 放入 C:\Users\\Documents\Visual Studio 2008\Visualizers
这是我用来“定义”可视化的代码...
使用
System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Microsoft.VisualStudio.DebuggerVisualizers;
using Foo.DebuggerVisualizers;
[assembly: DebuggerVisualizer(
typeof (BinaryDataDebuggerVisualizer),
typeof (VisualizerObjectSource),
Target = typeof (byte[]),
Description = "Binary Data to Image Visualizer")]
namespace Foo.DebuggerVisualizers
{
public class BinaryDataDebuggerVisualizer : DialogDebuggerVisualizer
{
protected override void Show(IDialogVisualizerService windowService,
IVisualizerObjectProvider objectProvider)
{
... my code in here
}
}
}
我制作了一个单元在调试器可视化解决方案中进行测试,该解决方案会启动并测试代码..它会正确显示合法(也是非法)图像文件。 所以我相信代码没问题。
当我处于真正的解决方案中时,这就是我正在做的事情(当我在调试模式下将鼠标悬停在变量上时,我希望放大镜显示)。
byte[] data = File.ReadAllBytes("Chick.jpg");
然后,当我在调试时暂停代码时,将鼠标悬停在变量 data
上(使用断点)。
没有沙漏:(
有人知道哪里出了问题吗?
I have created a debugger visualizer in VS2008. There are two classes i've made, in the same .dll :-
- BinaryDataDebuggerVisualizer
- ImageDebuggerVisualizer
The image one works fine (eg. the magnify glass appears in debug mode) but not for the byte[] one (BinaryDataDV). What my visualizer does is display the binary data as an image in a modal window (if the data is a legit image). I compiled to code in Release mode, then dropped the .dll into C:\Users\\Documents\Visual Studio 2008\Visualizers
this is the code that i used to 'define' the vis...
using
System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Microsoft.VisualStudio.DebuggerVisualizers;
using Foo.DebuggerVisualizers;
[assembly: DebuggerVisualizer(
typeof (BinaryDataDebuggerVisualizer),
typeof (VisualizerObjectSource),
Target = typeof (byte[]),
Description = "Binary Data to Image Visualizer")]
namespace Foo.DebuggerVisualizers
{
public class BinaryDataDebuggerVisualizer : DialogDebuggerVisualizer
{
protected override void Show(IDialogVisualizerService windowService,
IVisualizerObjectProvider objectProvider)
{
... my code in here
}
}
}
I've made a unit test in the debugger visualizer solution, which fires up and test the code .. which it correctly shows a legit (and also illegal) image files. so i believe the code is ok.
When i'm in my real solution, this is what i'm doing (where i expect the magnify glass to show, when i'm hovering over the variable in debug mode).
byte[] data = File.ReadAllBytes("Chick.jpg");
then i hover over the variable data
when i've paused the code while debugging, on that line (using a breakpoint).
No hourglass :(
anyone have any ideas to what is wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是这是不可能的。 调试器可视化工具框架存在限制,无法在数组类型或对象上运行。
http://msdn.microsoft.com/en-us/library/e2zc529c。 aspx
页面引用:
Unfortunately this is not possible. There is a limitation in the Debugger Visualizer framework that prevents them from functioning on array types or object.
http://msdn.microsoft.com/en-us/library/e2zc529c.aspx
Quote from the page:
此处描述了解决方法:https://joshsmithonwpf.wordpress.com/2008/01/ 由乔什·史密斯撰写。
在那篇文章中,他描述了一种特定可视化工具的使用(称为 Mole,它似乎不再存在); 我稍微删减了该文本,只留下通用概念。
A workaround is described here: https://joshsmithonwpf.wordpress.com/2008/01/ written by Josh Smith.
In that article he was describing the use of a particular visualizer (called Mole, which no longer seems to exist); I've cut down that text somewhat to just leave the general purpose concepts.