I am writing a simple C# Code, but the parts where Debug.WriteLine("..");
appear, get skipped. For instance:
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(SearchWordsDownloaded);
Debug.WriteLine("test");
wc.DownloadStringAsync(new Uri("SomeURL"));
Why is that happening?
WriteLine calls may not display in the output window if you have the Visual Studio option "Redirect all Output Window text to the Immediate Window" checked under the menu Tools → Options → Debugging → General. To display "Tools → Options → Debugging", check the box next to "Tools → Options → Show All Settings".
Writes information about the debug to the trace listeners in the Listeners collection.
Debug is going through the code flow during run time where as tracing is giving details of execution plan, process timing details. Debug and trace enables you to monitor the application for errors and exception with out VS.NET IDE. In Debug mode compiler inserts some debugging code inside the executable.
In Visual Studio uppermost menu choose Debug > Windows > Output. It shows all Console. WriteLine("Debug MyVariable: " + MyVariable) when you get to them.
I was seeing this - Debug.WriteLine() statements being jumped over for a debug build with the debugger attached. Not sure why but the DEBUG compilation symbol was not being set. Go to the project properties page, build section, and within the 'Conditional compilation symbols' field enter 'DEBUG' (without quotes). That caused the debugger to start entering Debug statements again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With