1 00:00:00,380 --> 00:00:03,690 We've set several breakpoints in our application, but 2 00:00:03,690 --> 00:00:07,282 what if we want to remove a few or simply disable them. 3 00:00:07,282 --> 00:00:11,305 The Breakpoints window provides a central place to manage all of our breakpoints. 4 00:00:11,305 --> 00:00:13,245 This is super helpful in a large project. 5 00:00:13,245 --> 00:00:19,770 To open the breakpoints window, click Debug>Window and then Breakpoints. 6 00:00:19,770 --> 00:00:23,130 Notice, that it has all of our breakpoints listed here. 7 00:00:23,130 --> 00:00:27,080 From here, we're able to quickly navigate to every breakpoint location in our code 8 00:00:27,080 --> 00:00:29,170 simply by double clicking the rows. 9 00:00:29,170 --> 00:00:32,297 You might wanna keep a breakpoint by temporarily avoid hitting it when 10 00:00:32,297 --> 00:00:33,250 debugging. 11 00:00:33,250 --> 00:00:34,170 From this window, 12 00:00:34,170 --> 00:00:38,680 you can use the checkboxes beside the breakpoints to enable or disable them. 13 00:00:38,680 --> 00:00:40,890 Let's disable a bunch of these breakpoints now. 14 00:00:44,903 --> 00:00:47,881 We can also create a special type of breakpoint from here called 15 00:00:47,881 --> 00:00:51,190 a Function Breakpoint by clicking on the New button. 16 00:00:51,190 --> 00:00:55,210 This Data Breakpoint type is only available when debugging C++ code 17 00:00:55,210 --> 00:00:58,770 right now but we can create function breakpoints. 18 00:00:58,770 --> 00:01:01,340 From here, we enter the name of the function. 19 00:01:01,340 --> 00:01:05,620 This will cause the debugger to pause before entering any method named Prompt. 20 00:01:06,770 --> 00:01:10,000 This is very helpful when debugging methods that might be overridden in 21 00:01:10,000 --> 00:01:14,830 subclasses or when we want to break on all implementations of an interface. 22 00:01:14,830 --> 00:01:18,901 This will cause the debugger to pause before running the base method or 23 00:01:18,901 --> 00:01:20,423 any overridden methods. 24 00:01:20,423 --> 00:01:21,330 I'll disable this right now. 25 00:01:24,347 --> 00:01:28,334 Finally, I want to mention that from the Breakpoints window, you can export and 26 00:01:28,334 --> 00:01:30,420 import sets of breakpoints. 27 00:01:30,420 --> 00:01:33,390 That's the purpose of these two buttons up here. 28 00:01:33,390 --> 00:01:37,220 This is one way to tell your fellow developers where exactly in the code 29 00:01:37,220 --> 00:01:42,880 an issue can be found or if you need to switch to debugging an unrelated issue, 30 00:01:42,880 --> 00:01:46,730 you can save off the breakpoints and then come back to them at a later time. 31 00:01:46,730 --> 00:01:51,420 When a breakpoint is hit, we often want to know how the program got there. 32 00:01:51,420 --> 00:01:53,790 That's the purpose of the Call Stack window. 33 00:01:53,790 --> 00:01:58,380 This is one of the windows that's usually open when Visual Studio is in debug mode. 34 00:01:58,380 --> 00:02:02,275 You can also open it by going to the debug windows menu. 35 00:02:02,275 --> 00:02:05,896 Lets run the debugger until we hit one of these breakpoints here where we're setting 36 00:02:05,896 --> 00:02:07,070 the song.name property. 37 00:02:12,630 --> 00:02:16,835 We can look here on the Call Stack to see that we've stopped where we're setting 38 00:02:16,835 --> 00:02:18,470 the Name property. 39 00:02:18,470 --> 00:02:23,880 We can see that this is being called from within the AddSong method, 40 00:02:23,880 --> 00:02:27,160 which in turn was called from the Main method. 41 00:02:27,160 --> 00:02:30,410 To go to any one of these methods, we can just double click on them. 42 00:02:30,410 --> 00:02:34,871 There are a bunch of options here when we right click on the call stack. 43 00:02:34,871 --> 00:02:36,540 Here, we can change what is shown. 44 00:02:36,540 --> 00:02:39,990 We can show or hide which assembly the method resides in or 45 00:02:39,990 --> 00:02:44,730 we can also pick whether or not to show the parameter types, names and values. 46 00:02:44,730 --> 00:02:49,370 This is helpful because the Call Stack can get quite full when everything is shown. 47 00:02:49,370 --> 00:02:53,960 Notice that nothing calls the Main method or does it? 48 00:02:53,960 --> 00:02:58,000 This is only showing code that is in this Visual Studio project. 49 00:02:58,000 --> 00:03:01,560 We can see what calls the Main method by right-clicking and 50 00:03:01,560 --> 00:03:03,570 clicking Show External Code. 51 00:03:08,686 --> 00:03:10,587 You might be surprised to see that there are so 52 00:03:10,587 --> 00:03:13,340 many things involved with starting your program. 53 00:03:13,340 --> 00:03:16,740 Calling Main isn't the only place we run into external code. 54 00:03:16,740 --> 00:03:20,380 We see it all the time when using code that's calling our code. 55 00:03:20,380 --> 00:03:24,540 Such as in web applications or other types of software frameworks. 56 00:03:24,540 --> 00:03:28,320 It's sometimes helpful to take a deeper look into the Call Stack to understand how 57 00:03:28,320 --> 00:03:29,000 things are working.