Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug.WriteLine not working

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.

like image 566
Chad Avatar asked Sep 02 '09 22:09

Chad


People also ask

What is Debug WriteLine in C#?

WriteLine(String)Writes a message followed by a line terminator to the trace listeners in the Listeners collection. public: static void WriteLine(System::String ^ message); C# Copy. [System.Diagnostics.Conditional("DEBUG")] public static void WriteLine (string message); C# Copy.

Where can I find Debug WriteLine?

Diagnostics. Debug. WriteLine will display in the output window ( Ctrl + Alt + O ), you can also add a TraceListener to the Debug.

How do I view console WriteLine Output in Visual Studio 2022?

In Visual Studio uppermost menu choose Debug > Windows > Output. It shows all Console. WriteLine("Debug MyVariable: " + MyVariable) when you get to them.

How does console WriteLine work?

WriteLine(String, Object, Object) Writes the text representation of the specified objects, followed by the current line terminator, to the standard output stream using the specified format information.


1 Answers

Check to see if the "Redirect all Output Window text to the Immediate Window" is checked under Tools -> Options -> Debugging -> General.

Alternatively, you can use the Console.WriteLine() function as well.

like image 61
JonnyD Avatar answered Sep 21 '22 19:09

JonnyD