String, oh string, what a character you are... "Visual Studio String Debug Visualizer"
So I've been on a little bit of a Visual Studio Extensibility kick recently, Saving your sanity with Snippets, Saving you some labor in creating your Unit tests..., Misspelled strings in your projects? Visual Studio Spell Checker (with source too). Meaning it might be time to post on something else...
But not today.
When I saw today's project by David Michener I got a chill. This is something that could have saved me hours and hours of effort in the past. It's simple, but in hindsight, something so obviously useful and needed...
This Visual Studio 2012 Debug Visualizer will show the hex values of a given string and the text value in a split window, revealing what is otherwise hidden data. This is useful when working, for example, with data that is read from a file that may have come from a *nix system and contains different line endings (CR vs CR/LF).
To use this visualizer with other versions of Visual Studio, just change the Microsoft.VisualStudio.DebuggerVisualizers references to the version that aligns with your Visual Studio version.
- Either compile the source -or- download the executable.
- Copy the executable from the compiled source (<home>\StringVisualizer\bin\Debug\StringVisualizer.dll) or the download to <MyDocuments>\Visual Studio 2012\Visualizers
- Restart Visual Studio.
When debugging a project you can hover on a String variable and select 'Advanced String Visualizer' from the spyglass icon in the tool-tip, or from the spyglass icon in the Locals or Autos windows.
And what's even better than this is that David released the source too...
As you can see, it's not complex or complicated, but that's the beauty of it.
Simple, easy and just works, fulfilling a common need.