I work with a lot of floating-point images, and would find it extremely useful to have an image-based representation of my arrays. I'd like to create a WPF UserControl that renders the data array (as shown below) as an image, instead of a scrollable list of text values.
Is this possible? I have looked at the MDSN documentation on VS 2010 extensibility, at SO's list of VS 2010 extensions, and at this topic on creating a custom editor, but I'm a bit lost on where to start.
Update 1:
Thanks to Brian and Basarat Ali for the leads on DebuggerVisualizer. Looks like the correct strategy, EXCEPT that unfortunately a visualizer for any type of arrays is disallowed.
A work-around (of limited utility) is to visualize a wrapper object.
At Brian's suggestion, I have posted a solution on CodePlex:
VS2010 Debugger Visualizers Contrib (http://debuggervisualizers.codeplex.com/).
The project's source code demonstrates a working wrapper visualizer and a non-functional "raw" data visualizer for a 1D double[] array. Here's a screenshot of the test console running:
If anyone has any suggestions on how to work-around this problem, please let me know!
Also, any explanation of why System.Array cannot be visualized is welcome!
Update 2:
I just re-searched SO with the word DebuggerVisualizer, and find this to be previously asked. Looks like user Will Dean suggests implementing Project Mole's work-around using a WeakReference. Don't see how this would work in a DebuggerVisualizer, though.
Update 3:
Josh Smith of Project Mole just suggested a very helpful work around (thanks Josh!):
Note, you can use your ArrayWrapper approach without needing to modify your source code to open a visualizer. You can type this into the Watch window in VS:
new YourNamespace.ArrayWrapper(myArray);
Hit the Enter key, then you should see a magnifying glass icon in the Watch window next to that line of code. Click it to open your custom visualizer.
You should create a debugger visualizer. Here's a walkthrough : http://msdn.microsoft.com/en-us/library/ms164759.aspx . I believe that what you want is to be able to view all the results in an external program. For this you can just add an export option to you list to export as a csv file. However if you still feel you want a bitmap you can convert the list to an image using RenderTargetBitmap : http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With