This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When you want to write a line to the debug console only when you're debugging, which API should you use?
System.Console.WriteLine
System.Diagnostics.Trace.WriteLine
System.Diagnostics.Debug.WriteLine
System.WriteLine
If you want to write a debug message only when the count is 0, what code would you use?
0
Debug.Assert(count != 0, "Count should not be 0.");
Debug.Assert(count == 0, "Count should not be 0.");
Debug.WriteIf(count != 0, "Count should not be 0.");
Debug.WriteIf(count == 0, "Count should not be 0.");
What are the top two values a debugger provides?
Control of your program execution and observation of your program's state
Modifying program values and changing your program output
Observing your program's state and modifying your program values
Editing your program while running and editing program values
Which Visual Studio Code debugger panel is most useful to observe the current value of a specific variable across different functions?
Use the Variables panel because it shows all variables that are currently in scope.
Hover over the variable in the code editor to display the value.
Use the Watch panel to select specific variables or expressions to watch throughout the program's execution.
Use the Call Stack panel.
You must answer all questions before checking your work.
Was this page helpful?