Riley asked this 1 year ago

Debug.WriteLine not working in VS 2017

On a Windows Forms application that i am developing with C# on Visual 2017, trying to write a string variable to the output window as below.

using System.Diagnostics;


but nothing appears in the output window when i run the code in debug mode. 

tried this instead:


Still nothing.

Best Answer by gen2018 1 year ago

Go to Tools -> Options -> Debugging -> General 

and look for the option Redirect all Output Window text to Immediate Window.

If that option is checked then the output from Debug.Writeline will be displayed on the Immediate window.  You can uncheck this option to view everything on Output window.

To open Immediate Window click Debug -> Windows ->Immediate or use the shortcut CTRL+G.

Riley 1 year ago
Thanks for the quick answer gen. that solved it.