1

My project properties are

  • Build/Configuration: Active(Debug)
  • Build/Platform: Active(Any CPU)
  • Build/Define DEBUG constant (Checked)
  • Build/Define TRACE constant (Checked)

In my code I've tried this:

System.Diagnostics.Debug.AutoFlush = true;
System.Diagnostics.Debug.WriteLine(text);

and this:

System.Diagnostics.Trace.AutoFlush = true;
System.Diagnostics.Trace.WriteLine(text);

and in desperation I've added:

#define DEBUG
#define TRACE
  • I've opened my application.exe.config file, there are no <system.diagnostics> entries. Which I believe is correct as M$FT assures me that if TRACE and DEBUG are enabled, the listeners are automatically created.

  • And my Output window in the debugger shows "Show output from: Debug" and the context menu for the output window has "Program Output" checked.

Each of the above items is from various StackOverflow posts. I've read every post I could find related to this issue, which is quite a lot. I have added and removed the above elements in my code in methodical fashion in an attempt to cover all possibilities of combinations. Yes, I've been at this for hours.

I'm using Windows 10, VS 2015 in C#; all pretty standard stuff.

Is there something else to check?

I don't know if this is a clue or not but every time a trace or debug writeline is run I see this in the output window

The thread '<No Name>' (0x41d4) has exited with code 0 (0x0).

So, my output window generally looks like this.

The thread '<No Name>' (0x68f4) has exited with code 0 (0x0).
The thread '<No Name>' (0x6f58) has exited with code 0 (0x0).
The thread '<No Name>' (0xc260) has exited with code 0 (0x0).
The thread '<No Name>' (0xa87c) has exited with code 0 (0x0).
The thread '<No Name>' (0x80a4) has exited with code 0 (0x0).
The thread '<No Name>' (0xdb8c) has exited with code 0 (0x0).
The thread '<No Name>' (0xad44) has exited with code 0 (0x0).
The thread '<No Name>' (0x3b88) has exited with code 0 (0x0).
The thread '<No Name>' (0xcbb4) has exited with code 0 (0x0).

At first, I thought this output was related to all the async methods (we have a lot) but then I noticed they seem to happen on every trace/debug call.

Display name
  • 1,228
  • 1
  • 18
  • 29

1 Answers1

0

I just debug a simple app in my side, I could get the result like the following screen shot, I could get the correct output messages in my side using the VS2015.

enter image description here

I don't know if this is a clue or not but every time a trace or debug writeline is run I see this in the output window The thread '' (0x41d4) has exited with code 0 (0x0).

My understanding is that it was related to the Output window settings, if a thread has exited with code 0 it ran successfully. If you don't want to get those messages, you could disable them.

Reference:

The thread has exited with code 0 (0x0) with no unhanded exception

enter image description here

Jack Zhai
  • 6,230
  • 1
  • 12
  • 20
  • I'll check out the exclusion of "Thread Exit Messages". As for the System.Diagnostic.(Trace|Debug).(AutoFlush|WriteLine) calls, I have those in my code now. As is they don't work. I am hoping for additional items, settings, configuration settings, etc. that I may have over looked. – Display name Jun 30 '17 at 13:49