Skip to content

Commit f9e6a6c

Browse files
committed
review-2
1 parent 2b344e2 commit f9e6a6c

File tree

8 files changed

+95
-95
lines changed

8 files changed

+95
-95
lines changed

learn-pr/language/dotnet-debug-visual-studio/8-knowledge-check.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uid: learn.dotnet-debug-visual-studio.knowledge-check
33
title: Module assessment
44
metadata:
55
title: Module assessment
6-
description: Check what you've learned.
6+
description: Check what you learned about debugging in Visual Studio.
77
author: alexwolfmsft
88
ms.author: alexwolf
99
manager: jmartens
@@ -33,36 +33,36 @@ quiz:
3333
choices:
3434
- content: '`Debug.Assert(count != 0, "Count should not be 0.");`'
3535
isCorrect: false
36-
explanation: "Assert tests a condition. If it's true, nothing will happen or else the application will enter break mode. So here, if the count is 0, it will enter break mode."
36+
explanation: "Assert tests a condition. If it's true, nothing happens or else the application enters break mode. So here, if the count is 0, it enters break mode."
3737
- content: '`Debug.Assert(count == 0, "Count should not be 0.");`'
3838
isCorrect: false
39-
explanation: "Assert tests a condition. If it's true, nothing will happen or else the application will enter break mode. So here, if the count is 0, nothing will happen."
39+
explanation: "Assert tests a condition. If it's true, nothing happens or else the application enters break mode. So here, if the count is 0, nothing happens."
4040
- content: '`Debug.WriteIf(count != 0, "Count should not be 0.");`'
4141
isCorrect: false
4242
explanation: "This code prints a message when the count doesn't equal 0."
4343
- content: '`Debug.WriteIf(count == 0, "Count should not be 0.");`'
4444
isCorrect: true
45-
explanation: "This code will only print a debug message when the count is 0."
45+
explanation: "This code only prints a debug message when the count is 0."
4646
- content: "What are the top two values a debugger provides?"
4747
choices:
4848
- content: "Control of your program execution and observation of your program's state"
4949
isCorrect: true
5050
explanation: "The two main values almost every debugger provides are the ability to control program execution and to observe program state."
51-
- content: "Modifying program values and changing your program output"
51+
- content: "Modifying program values and changing your program output."
5252
isCorrect: false
53-
explanation: "Changing your program's output isn't useful because it will only have effect when the application is being debugged."
54-
- content: "Observing your program's state and modifying your program values"
53+
explanation: "Changing your program's output isn't useful because it only has effect when the application is being debugged."
54+
- content: "Observing your program's state and modifying your program values."
5555
isCorrect: false
5656
explanation: "Observing and modifying values are important, but it's also important to be able to control the flow of program execution."
57-
- content: "Editing your program while running and editing program values"
57+
- content: "Editing your program while running and editing program values."
5858
isCorrect: false
5959
explanation: "Editing programs is useful, but observing your program's operational state is another important value that the .NET debugger provides."
6060
- content: "Which Visual Studio debugger window is most useful to observe the current value of a specific variable across different functions?"
6161
choices:
6262
- content: "Use the Locals window because it shows all variables that are currently in scope."
6363
isCorrect: false
6464
explanation: "While the Locals window does display all variables currently in scope, it's not the best way to watch the value of a specific variable."
65-
- content: "Hover over the variable in the code editor to display the value."
65+
- content: "Display the value by hovering over the variable in the code editor."
6666
isCorrect: false
6767
explanation: "While hovering does display the variable's current value, it's a manual process and isn't efficient."
6868
- content: "Use the Watch window to select specific variables or expressions to watch throughout the program's execution."

learn-pr/language/dotnet-debug-visual-studio/includes/3-analyze-your-program-state.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Let's start by learning how to use the Visual Studio debugger with .NET.
44

55
## Getting started with the Visual Studio Debugger
66

7-
Use the **Start** button in the Visual Studio command bar to launch the application with the debugger attached. Notice that the command bar now includes our project name. Once the app is running, more debugging tools and features become available.
7+
Use the **Start** button (the solid green triangle) in the Visual Studio command bar to launch the application with the debugger attached. Notice that the command bar now includes our project name. Once the app is running, more debugging tools and features become available.
88

99
:::image source="../media/visual-studio-debugging-controls.png" alt-text="Screenshot of Visual Studio debugging controls.":::
1010

@@ -15,21 +15,19 @@ Use the **Start** button in the Visual Studio command bar to launch the applicat
1515

1616
### Controlling execution
1717

18-
Once the app is running, the debugging controls appear next to the **Start** button you clicked to launch the app.
18+
Once the app is running, the debugging controls appear next to the **Start** button that you clicked to launch the app.
1919

2020
:::image source="../media/visual-studio-steps.png" alt-text="Screenshot of Visual Studio debugger execution controls.":::
2121

22-
The controls are numbered as follows:
23-
2422
- **1) Continue or pause execution**. If execution is paused on a breakpoint, select this button to continue until the next breakpoint is hit. If your program is running, the button switches to a pause button that you can use to pause execution.
25-
- **2) Hot reload controls**. This new feature of Visual Studio 2022 allows you to make changes and refresh our code without restarting the app.
23+
- **2) Hot reload controls**. This feature, introduced in Visual Studio 2022, allows you to make changes and refresh your code without restarting the app.
2624
- **3) Stop**. This button stops the running application, which also detaches the debugger.
2725
- **4) Restart**. Stops and relaunches the app with the debugger attached.
2826
- **5) Step into**. If the next statement is a function call, move down into the first code statement of this function (same as the `step` command).
2927
- **6) Step over**. If the next statement is a function call, execute the code, but move on immediately to the next line of code in the current function.
3028
- **7) Step out**. If you're inside a function, execute the remaining code of this function and jump back to the statement after the initial function call (same as the `out` command).
3129

32-
Breakpoints are one of the core features of debugging and integrate with these controls, so let's explore them in more detail.
30+
Breakpoints are one of the core features of debugging and they integrate with these controls, so let's explore them in more detail.
3331

3432
## Breakpoints
3533

@@ -39,33 +37,33 @@ You can add a breakpoint in Visual Studio by clicking to the left side of the li
3937

4038
:::image source="../media/visual-studio-breakpoint.png" alt-text="Screenshot of a breakpoint added in the Visual Studio editor window.":::
4139

42-
If you right-click to add a breakpoint or on an existing breakpoint, you can also select **Add Conditional Breakpoint**. This special type of breakpoint allows you to define a *condition* or criteria for when the breakpoint is triggered. This menu also allows you to select **only Enable when following breakpoint is hit option** to create a chainable breakpoints execution, among other actions.
40+
If you right-click to add a breakpoint, or right-click on an existing breakpoint, you can also select **Add Conditional Breakpoint**. This special type of breakpoint allows you to define a *condition* or criteria for when the breakpoint is triggered. This menu also allows you to select the **Only Enable when the following breakpoint is hit** option to create a chainable breakpoints execution, among other actions.
4341

4442
:::image source="../media/visual-studio-breakpoint-conditional.png" alt-text="Screenshot of setting a conditional breakpoint in Visual Studio.":::
4543

46-
You can also use a Temporary breakpoint if you want to break the code just one time. You can apply Temporary breakpoints by right-clicking in the breakpoint column and selecting **Insert temporary breakpoint**. The Temporary breakpoints will be removed after they're hit the first time.
44+
You can also use a *temporary breakpoint* if you want to break the code just one time. You can apply temporary breakpoints by right-clicking in the breakpoint column and selecting **Insert Temporary Breakpoint**. The Temporary breakpoints will be removed after they're hit the first time.
4745

48-
You can also add Tracepoints by right-clicking in the breakpoint column. Tracepoints allow you to log information to the Output window under configurable conditions without modifying or stopping your code execution.
46+
You can also add *tracepoints* by right-clicking in the breakpoint column and selecting **Insert Tracepoint**. Tracepoints allow you to log information to the Output window under configurable conditions without modifying or stopping your code execution.
4947

5048
Finally, in the **Breakpoints** window (**Debug** > **Windows** > **Breakpoints**), you can see and toggle all the breakpoints you placed in your code. You can also toggle options to break on caught or uncaught exceptions. You can use the **Breakpoints** panel to examine your program state and trace back the source of an exception by using the **Call stack** when one occurs.
5149

5250
:::image source="../media/visual-studio-breakpoints-window.png" alt-text="Screenshot of the Visual Studio Breakpoints window.":::
5351

5452
## Visual Studio debugging tools
5553

56-
After you've set up your breakpoints and started your app, new information windows and controls appear on the screen.
54+
After you set up your breakpoints and start your app, new information windows and controls appear on the screen.
5755

5856
:::image source="../media/visual-studio-controls.png" alt-text="Screenshot of Visual Studio debugger overview.":::
5957

60-
1. Debugger launch controls
61-
1. Current breakpoint and execution line
62-
1. Watch window to monitor variable values
63-
1. Breakpoints window to view all breakpoints
58+
1. Debugger launch controls.
59+
1. The current breakpoint and execution line.
60+
1. **Watch window** for monitoring variable values.
61+
1. **Breakpoints window** for viewing all breakpoints.
6462

6563
You can also access other helpful debugging windows by selecting **Debug** > **Windows** along the top navigation bar. For example, commonly used tools include:
6664

67-
1. **Call Stack window**: Allows you to view which methods have been called.
68-
2. **Immediate window**: Allows you to write and expressions while debugging.
65+
1. **Call Stack window**: Allows you to view which methods were called.
66+
2. **Immediate window**: Allows you to write and evaluate expressions while debugging.
6967
3. **Autos window**: Automatically adds watches to variables in the current context.
7068
4. **Output window**: Shows the output of logging statements or code that writes to the console.
7169

@@ -84,17 +82,17 @@ When you analyze the cause of a program defect, you can watch the state of your
8482

8583
Most of these windows also allow you to double-click the value of a variable and change its value while debugging.
8684

87-
The **Watch** windows are useful for tracking variables during the execution of your code. You can right-click a variable in your editor and select **Add to watch**. That variable now displays in the watch window and updates automatically as your app executes.
85+
The **Watch** window is useful for tracking variables during the execution of your code. You can right-click a variable in your editor and select **Add to watch**. That variable now displays in the watch window and updates automatically as your app executes.
8886

8987
You can also right-click variables in the **Autos** or **Locals** windows to add a watch.
9088

91-
Another productive way to view and analyze the variable information during debugging is using DataTips. When you pause at the breakpoint, hover over any variable in the current scope. A DataTip appears, showing the name and current value of the variable properties. By hovering over a function parameter or a variable directly in the editor window, you can also peek at its value.
89+
Another productive way to view and analyze the variable information during debugging is by using *DataTips*. When you pause at the breakpoint, hover over any variable in the current scope. A DataTip appears, showing the name and current value of the variable properties. By hovering over a function parameter or a variable directly in the editor window, you can also peek at its value.
9290

9391
### Call stack
9492

9593
Every time your program enters a function, an entry is added to the call stack. When your application becomes complex and functions are called within other functions many times, the call stack represents the trail of those calls.
9694

97-
It's useful to find the source of an exception. If you have an unexpected crash in your program, you often see something in the console like the following example:
95+
It's useful for finding the source of an exception. If you have an unexpected crash in your program, you often see something in the console like the following example:
9896

9997
```text
10098
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
@@ -104,11 +102,11 @@ Unhandled exception. System.IndexOutOfRangeException: Index was outside the boun
104102

105103
The group of `at [...]` lines under the error message is called a *stack trace*. The stack trace gives the name and origin of every function that was called before ending up with the exception. However, it can be a bit difficult to decipher, because it also includes internal functions from the .NET runtime.
106104

107-
The Visual Studio **Call stack** window comes in handy here. It filters out unwanted information to show you only the relevant functions from your own code by default. You then can unwind this call stack to find out where the exception originated from.
105+
The Visual Studio **Call stack** window comes in handy here. It filters out unwanted information to show you only the relevant functions from your own code by default. You can then unwind this call stack to find out where the exception originated from.
108106

109107
:::image source="../media/visual-studio-callstack.png" alt-text="Screenshot of the Call Stack window.":::
110108

111-
In the next unit, you'll walk through an exercise using the debugger to fix the bug in the Fibonacci code we saw previously.
109+
In the next unit, you walk through an exercise using the debugger to fix the bug in the Fibonacci code we saw previously.
112110

113111
### Specify debugger settings
114112

0 commit comments

Comments
 (0)