Search
Sunday, August 01, 2010 ..:: Home ::.. Register  Login
   Calendar  
     
  
   Search  
     
  
   Blogroll  
     
  
   Disclosure  
All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
     
  
   TechTidBits (Blog)  
Nov 19

Written by: Peter Henry
Thursday, November 19, 2009 9:16 PM

When you're debugging your code and come across an Image/Bitmap, how does Visual Studio show it to you?  Quick?  What's the answer?  You're able to see a DataSet using the DataSet Debugging Visualizer but that's not the case with Images!  Why is that?  Why didn't MS just provide one natively?  That's one gaping hole IMHO.

Debugging without Image Debugging Visualizers

HHHMMM?  Ya, like THAT'S useful?!  Well, that information is all good'n'dandy but what's it REALLY telling you?  Look at the Size property, yup, you have an image!  But really that's about all you can tell about.  You can't tell what it looks like if you downloaded it from the web on the fly?  You certainly can't tell if it's a photo or piece of clip art?  This type of view doesn't give you a context.  Let's fix that!

I have another blog which shows you how to create your own Debugging Visualizer, but today I got tired of not having one specifically for Images/Bitmaps, so very quickly I whipped one up. 

Image/Bitmap Debugger Visualizer at runtime

The benefits to using this Image/Bitmap Debugger Visualizer are:

  • clear context of the picture you're dealing with
    • including IF you indeed have a picture, you'll see a message about no image if it's null/missing
  • you can easily see the size of the image (KB) as well as the height and width of it
  • you can quicly hit ESC to get back to your debugging session, the faster you see the bigger picture the faster you can fix the bug right?
  • if you want to save the image for what ever reason, hit th File\Save As and you can save the image in multiple formats (GIF, BMP, PNG, JPG)

The solution is available as well as the one DLL file (as a zip) to download and copy to one of the following directories (depending on the version of Windows you have).

x86:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers

x64:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers

Now that you can see exactly what you think (or not think HAHA) you have, it's time to grab a coffee and get coding!

 

Resources:

Code: http://www.pchenry.com:8080/svn/blog/trunk/2009/ImageDebuggerVisualizer

Image Debugger Visualizer (as ZIP) to copy to correct location to use

PCHenry, TechTidBits: Visual Studio Debugger Visualizers are VERY cool! You gotta check this out!

 

Copyright ©2009 Peter Henry

Tags:

Your name:
Title:
Comment:
Add Comment    Cancel  
     
  
Copyright 1999-2010 by PCHenry.com   Terms Of Use  Privacy Statement