.NET Zone is brought to you in partnership with:

I am developer and technology maniac who is working on Microsoft and PHP technologies. I have ASP.NET MVP title and I hold MCAD, MCSD and MCTS certificates. When I have free time I usually play with new technologies, hack something, read books, participate in communities and speak in events. I am also active blogger and my ASP.NET blog is the place you can find some interesting reading about my discoveries and personal thoughts. Gunnar is a DZone MVB and is not an employee of DZone and has posted 136 posts at DZone. You can read more from them at their website. View Full User Profile

Using DebugView to catch debug output of .NET program

05.19.2011
| 4156 views |
  • submit to reddit
Often asked question: is there any way to gather debug output of .NET program that is running on environment where Visual Studio is not installed? Yes, you can do it and you can do it for free with program called DebugView. Here’s how it works.

After downloading and unzipping DebugView you can run it and select debug output options. I suggest you to run it as Administrator because otherwise it may state that there is already debugger up and running when you try to check Capture Global Win32 option.

 Capture options

DebugView starts listening immediately. As a next thing I will write some debug information to my code. This is one of my action methods in very early state and it’s safe to play with it.

public ActionResult Index(int page = 1)
{
    Debug.WriteLine("HomeController.Index: started, page=" + page);
 
    PagedResult<Event> events;
 
    using (var model = new EventsEntities())
    {
        events = model.ListPublicEvents(page);
    }
 
    Debug.WriteLine("HomeController.Index: finished");
    return View(events);
}

Now let’s run the code and see what DebugView is able to catch. Don’t run the code through Visual Studio as it attaches its own debugger and DebugView is not able to catch the output then.

 Debug output

Besides log messages you can also see how much time it takes to move from one debug output to another. If you have lengthy output then you can also use find functionality to search for specific log messages.

References
Published at DZone with permission of Gunnar Peipman, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)