Tuesday, October 30, 2007

Unescaping strings in the Immediate window (C#) when debugging

Ever get annoyed at the unfriendly strings the Visual Studio debugger prints when running a C# project in the IDE?

Here's a creative solution courtesy of Daniel Cazzulino's Blog:

At debugging-time, if you ask for any string variable value you get it escaped, which isn't very useful. You can't copy/paste to a text editor to save to a file and check how it looks like, for example. A trick I use all the time is issuing the following command in the Command Window - Inmediate:

System.Diagnostics.Debugger.Log(0, "", theTextVariable) You will get in the same window, the unescaped string, including any tabs, CRLF, etc.

Read the original at http://weblogs.asp.net/cazzu/archive/2004/02/10/70658.aspx

No comments: