Monday, April 04, 2011

Going from Fugly to Fabulous by giving your objects their own debugging visualizer

Clarity Consulting Blogs - Write Your Own Debugging Visualizer

“Have you ever been stepping through a program and tried to inspect an object only to find it has an internal structure that make it very difficult to really see what is going on in there? I recently ran into a third party object that was causing me that problem over and over so I decided to do something about it. I wrote my own debugging visualizer to take the object and put it into a format that is easy to read. I was surprised how easy it is to do, so lets create one.

The Setup

The object I was struggling with was storing collections of name/value pairs internally in 2 different collections. So I’d have to find the key I’m interested in, note the index and find the corresponding index in the values collection. It was actually worse than this since the collections were also hierarchical. Ouch. So I put together a simple class that demonstrates this called WeirdCollection. It looks like this:

SNAGHTML62fb9737

SNAGHTML62fa748b

…”

Been a while since I’ve seen a good article on writing your own Debugging Visualizer…

 

Related Past Post XRef:
One gets you Ten. One DLL, Ten free WCF Debugger Visualizers
A Couple Custom Debugger Visualizers (For VS2005, but with source...)

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...