I have created a debugger visualizer in VS2008. There are two classes i've made, in the same .dll :-
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?
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:
"You can write a custom visualizer for an object of any managed class except for Object or Array"