3

I'm having an odd problem With Trace.WriteLine not producing any output. I've traced the code and Trace.Writeline is definitely getting called, but no output is appearing in the Output window or in SysInternals' DebugView.

Is something wrong with my system? How can I repair this?

Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • You'll never get anything in DebugView, VS2010 has a debugger that properly traps OutputDebugString(). Right-click the Output window and check the tick marks. And check that you've got the Debug configuration selected. – Hans Passant Dec 13 '11 at 01:51

2 Answers2

1

There's a setting in Visual Studio that can cause trace/debug output to end up in a different window. To be sure, choose Tools | Options... | Debugging and make sure the check-box labeled Redirect all Output Window text to the Immediate Window is unchecked.

Burt_Harris
  • 6,415
  • 2
  • 29
  • 64
1

Make sure there is an appropriate TraceListener in the Trace.Listeners collection.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • Trace output normally goes to the debug window by default and I don't have to do anything. Why would this be different now? How can I restore the default behavior? – Tim Long Dec 13 '11 at 02:01
  • @TimLong Check your app config, and make sure you don't have a different listener setup (see http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelistener.aspx) Also, make sure you're building with a Debug config... – Reed Copsey Dec 13 '11 at 02:09
  • @TimLong I've also run into cases where 3rd party library code I used fudged the Trace.Listeners collection when it ran. Another good tip is to add your own custom TraceListener and see if it works. – Omer Raviv Dec 13 '11 at 18:54