调试器可视化不工作?我是否正确注册了吗? [英] Debugger Visualizer not working? Have i incorrectly registered it?

查看:175
本文介绍了调试器可视化不工作?我是否正确注册了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了VS2008调试器可视化工具。有两类我所做的,在同一个.dll文件: -

I have created a debugger visualizer in VS2008. There are two classes i've made, in the same .dll :-

  • BinaryDataDebuggerVisualizer
  • ImageDebuggerVisualizer

1工作正常的图像(例如,在放大玻璃出现在调试模式),但不为字节[]酮(BinaryDataDV)。什么我的可视化确实是在模式窗口显示的二进制数据作为图像(如果数据是一个合法的图像)。我在释放模式编译为code,然后扔下.dll文件到C:\用户\\文档\ Visual Studio 2008的\展示台

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

这是在code,我用'定义'的VI ...

this is the code that i used to 'define' the vis...

使用

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
        }
     }
}

我做了一个单元测试在调试器可视化解决方案,它会调用和测试code ..它正确地显示了一个合法的(并且也是非法的)图像文件。所以我认为,code就可以了。

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");

然后我将鼠标悬停在变量数据时,我已暂停在调试时,在该行(使用断点)​​在code。

then i hover over the variable data when i've paused the code while debugging, on that line (using a breakpoint).

没有沙漏:(

任何人有任何想法,有什么不好?

anyone have any ideas to what is wrong?

推荐答案

不幸的是,这是不可能的。有一个在调试器可视化的框架,$ P $从数组类型或对象功能pvents他们的限制。

Unfortunately this is not possible. There is a limitation in the Debugger Visualizer framework that prevents them from functioning on array types or object.

<一个href="http://msdn.microsoft.com/en-us/library/e2zc529c.aspx">http://msdn.microsoft.com/en-us/library/e2zc529c.aspx

从页面引用:你可以写一个自定义的可视化工具的任何管理类的对象除了对象或阵

Quote from the page: "You can write a custom visualizer for an object of any managed class except for Object or Array"

这篇关于调试器可视化不工作?我是否正确注册了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆