Friday, December 03, 2010

DebugView doesn’t work with Asp.Net app

I like to use a lot of Debug.WriteLine calls for monitoring how my application is working (especially when I am developing a new feature that might be resource intensive).

Debug.WriteLine will correctly output data to the Output window of Visual Studio. But if you run DebugView (the SysInternals tool for capturing debug data), you will find that DebugView doesn’t capture the debug text.

What I found was that for DebugView to see the debug data, you cannot have the VisualStudio debugger attached to that process. Once I reran my app without debugging (Ctrl + F5), DebugView automatically began displaying the debug text.

Another thing to remember is that you need to enable the “Capture Global Win32” option in DebugView for it to see Asp.Net debug messages.

image

Note:

This behavior is by design according to the Visual Studio team (Only one debug listener can be enabled at any given time). See: http://connect.microsoft.com/VisualStudio/feedback/details/457063/outputdebugstring-doesnt-work-in-the-debugger-vs-2010-pro-beta-1-c

The compiler will automatically ignore all calls to methods in the Debug class if you build your solution in Release configuration. So if you are wondering why your DebugView is not seeing your debug text in production, that is probably why.

1 comment:

Unknown said...

For some reason this does not work on my Win2k3 machine. All things been set, Capture Global Win32 and Debug version build.