DebugView Tool – How it saved my day

DebugView output

The DebugView Tool is a wonderful tool that saved my day today. It enables you to see Debug / Trace info that your code emits in real-time, without any config in Web.config, App.config, etc.. So while the application is running, you can see what it does. For example an ASP.NET Web Application or Windows Service. I never knew it existed until today. DebugView for Windows can be downloaded from Microsoft’s Sysinternals team: It requires no installation. It’s a tool created by Mark Russinovich. He’s my hero. I use one of the other tools he created (Process Monitor) once in a while too. A real time saver for troubleshooting.

How DebugView saved my day

If you’re a programmer, you know about troubleshooting bugs. It can sometimes take days to find the cause of a problem and fix it. For me, it’s very satisfying to fix a problem before the end of the work day on friday, a good start of the weekend.

So today a colleague and me were debugging a Windows Service that was misbehaving in the test environment. There were no messages in the EventLog, nothing in the logs of the application, so this left us puzzled. After some staring at the code I found a method that I expected to be the culprit. At first I thought I’d need to write a very simple Logger class that logs to a textfile, and then add Log statements to the code. But then I found out that the piece of code I suspected already had Trace.WriteLine statements, including in the catch block.

So next thing I wanted to do was to enable tracing in the config file of the Windows Service. This is not very hard, but sometimes you run into permission problems, because the account under which the application runs needs write permissions to the logfile, and you have to set these permissions to make it work. So I explained the problem to two of my colleagues. One of them told me about this DebugView tool. I immediately set it to work, and it was precisely what I needed. So the colleague I was debugging with started a process in the application that should trigger the error. To my delight I saw an error in the output that told me that the service expected a certain version of a dll. So I reinstalled the service with the right dlls, and the problem was fixed.

How to use DebugView

Put Debug.WriteLine or Trace.WriteLine statements in your code using the System.Diagnostics namespace like this:




This will make the debug info appear in DebugView as the code executes:

DebugView output

– Make sure that you run the tool as Administrator (right mouse click on the executable -> Run as Administrator)
– Select the following option in the menu: Capture Global Win32 (the other option “Capture Win32” is on by default).

Set Options Capture Global Win32

You can also apply filters on the output. In the Menu go to Edit -> Filter/Highlight (or click the filter icon in the buttonbar (third on the right).

DebugView filter output
If you have Trace messages that start with [TS] , this will make sure you only see these.