Reputation:
I have the following line in my code:
System.Diagnostics.Debug.WriteLine("Title:" + title + "title[top]: " + title[top] + "title[sub]: " + title[sub]);
When I debug I see it going to this line, but when I look at the output window in Visual Studio 2010 I don't see anything even though it shows for "Debug" and I ran using "debug > run". Why?
Upvotes: 38
Views: 53612
Reputation: 599
I had the same problem. Using Trace.WriteLine and checking "Define DEBUG constant" did not work for me.
I noticed that the output messages were found in the Immediate Window instead of the Output Window.
Then I unchecked the "Redirect all Output Window text to the Immediate Window" option in Tools and solved my problem.
Upvotes: 6
Reputation: 1170
Also, check that the "Program Output" is checked in the Messages selection (right-click in Output window.
Upvotes: 1
Reputation: 101
Using "System.Diagnostics.Debug.WriteLine" I've output in the Immediate Window :-O
Upvotes: 1
Reputation: 1780
For me, I needed to do this to solve the problem:
1. Open the project's property page
2. Under Build tab, check "Define DEBUG constant" and "Define Trace constant"
Voila!
Upvotes: 7
Reputation: 6778
For me, this solved the problem:
System.Diagnostics.Trace.WriteLine("whatever");
(using Trace
instead of Debug
)
Upvotes: 21
Reputation: 8521
Check following items -
DEBUG
mode is selected while debuggingDebug
option is selected in Output window -
Debug.AutoFlush = true
at the beginning of codeReference for Point #5 (Read the comment, It worked for that guy)
Upvotes: 22
Reputation: 81313
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. If it is there delete it-->
<clear/>
</listeners>
</trace>
</system.diagnostics>
Upvotes: 8