November 23, 2011

Programming: Disable All Breakpoints

Have you debugged a program using a breakpoint? It is pretty helpful right? You get to determine the bugs you have in your code by stepping into the program's methods and see if it worked the way you want them to. But isn't it annoying when you are so confident with your code fix and you forget to remove the breakpoint and you test your program and it moves back to Visual Studio because of that red dot?

During one of my programming tasks within this week, I am assigned to refactor codes to make the system work faster. Part of my task is to determine the frequency of the method calls. For this task, I used breakpoints and placed them in each method. During the testing phase, some codes didn't work because it was being barred by the breakpoint. I removed the breakpoint and it worked. But still, I need to know the frequency so I added the breakpoint again. As expected, it was barred once more.

To solve this issue since it is pretty annoying to the programmer to add and remove breakpoints, I used the Disable All Breakpoints command from the Debug menu. As the name implies, it disables all breakpoints but it still stays where it was placed. With this, the program can be tested smoothly. If there is a need to use the breakpoints again, just hit the Enable All Breakpoints from the same menu.

Photo from MSDN Blogs

No comments:

Post a Comment