Friday, August 08, 2008

Byte Array Debugger Visualizer

As part of a debugging session, I wanted to visualize a byte array as a string so I did a little googling for something that would display data in Visual Studio as a string. The following article: http://www.alexthissen.nl/blogs/main/archive/2006/01/21/debugger-visualizers-and-arrays.aspx claims it's not possible. I'll believe him.

What I did to workaround the problem was to inspect the MemoryStream (since that is where the byte array I'm interested is buried) then in the QuickWatch window I typed:
System.Text.Encoding.ASCII.GetString(ms._buffer)
where ms is my MemoryStream.

That displays a string that I can look at with the string visualizer. Problem sort of solved.

1 comment:

Mladen said...

This is for you then. A byte aray hex visualizer... https://bitbucket.org/mmihajlovic/hex-visualizer/wiki/Home