Debug.WriteLine not working

debugging, vb.net

Solution

All good suggestions. I noticed that I don't see this tip mentioned, so I'll say it: In your app.config file, make sure you don't have a `<clear/>` element in your trace listeners.

You will effectively be clearing the list of trace listeners, including the default trace listener used for Debug statements.

Here's what this would look like in your app.config file:

<system.diagnostics>
    <trace>
      <listeners>
          <!-- This next line is the troublemaker.  It looks so innocent -->
          <clear/>
      </listeners>
    </trace>
  </system.diagnostics>

If you want to have a placeholder for trace listeners in your app.config file, you should instead use something like this:

<system.diagnostics>
    <trace>
      <listeners>
      </listeners>
    </trace>
  </system.diagnostics>

Problem

In the past, perhaps versions of Visual Studio prior to the 2008 that I am using now, I would do something like this in my VB.NET code: ``` System.Diagnostics.Debug.WriteLine("Message") ``` ..and the output would go to the output window. Now it doesn't. Something must first apparently be enabled. If this involves "attaching a debugger", please explain how to do it. It seems to me that it should just work without too much of a fuss. Here's a video explaining the issue in real time and showing you all my settings: http://screencast.com/t/YQnPb0mJcs I'm using Visual Studio 2008.

Original source