From the course: Visual Studio: Advanced Debugging Tools
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Conditional breakpoints from Thread ID - Visual Studio Tutorial
From the course: Visual Studio: Advanced Debugging Tools
Conditional breakpoints from Thread ID
- [Instructor] Imagine for a minute that this for loop counts from one to five thousand, and I'd like to put a breakpoint on line 35 that stops somewhere near the middle of that loop. In other words, around counter equals 2500. You don't want to have to press F5 or F11 or step through your code 2500 times, to get to this line of code. You can use a conditional breakpoint instead. You can also use a conditional breakpoint with the thread ID, which is why it's in this chapter. To create a conditional breakpoint, hover over the red circle and click on settings and choose conditions. There's several choices in this dropdown. We're interested in this top one, conditional expression is true. And then you write the expression here, which is counter equal to three. Press enter to save that value and then close this popup. And notice there's a white plus sign and it appears in the center of the breakpoint. And also, if I…
Contents
-
-
-
-
-
-
(Locked)
Debug multithreaded code2m 47s
-
(Locked)
Run the sample application3m 51s
-
(Locked)
Examine the sample application code8m 22s
-
(Locked)
Overview of the thread debug windows1m 54s
-
(Locked)
Debug with the Threads window3m 21s
-
(Locked)
See worker threads in the Threads window3m 3s
-
(Locked)
Show threads icons in the source editor1m 13s
-
(Locked)
Debug with the parallel watch2m 12s
-
(Locked)
Identify threads with custom names and Flags3m 3s
-
(Locked)
View the Thread call stack1m 37s
-
(Locked)
Examine the modified code for Parallel Stack1m 50s
-
(Locked)
Use the Parallel Stack window4m 6s
-
(Locked)
Conditional breakpoints from Thread ID2m 53s
-
(Locked)
Freeze and thaw threads2m 22s
-
(Locked)
-
-
-