Posts Tagged ‘Export’

Howdy people,

This time we’re going to have a look at another small (but effective) improvement in Visual Studio 2010: The breakpoints got some new achievements, namely:

  1. Labeling breakpoints
  2. Searching for breakpoints (Breakpoints Window)
  3. Specifying hit counters
  4. Import/Export breakpoints

Labeling is easy-to-use and newly available in Visual Studio 2010 (not in the Express Editions). Later on, we can also use these labels for searching.

After setting up a small console application (containing only the default-generated Program class), let’s declare an array of type Int32 and name it values. A simple foreach loop should iterate over the array. We’ll also place a breakpoint at the beginning of the loop. That’s enough for showing the new achievements. Figure 1 shows it:



Figure 1: After setting the breakpoint


After we’ve set the breakpoint, we can deliberately access the labels by right-clicking on the breakpoint and choosing EDIT LABELS from the context menu, as seen in Figure 2.



Figure 2: Accessing labels after a right click on the breakpoint

A window will open, allowing to define a new breakpoint label or to assign an existing one. In our case, I have already defined a label “NumberLoop”, which we’re gonna reuse. A check near the label in the list does the assignment, and confirming the dialog window sets the assignment. From now on, our breakpoint is called “NumberLoop”.


Figure 3: Label definition/assignment

We can verify the assignment immediately by bringing up the Breakpoints Window, which is located under Debug-Windows-Breakpoints Window (CTRL+D, B).


Figure 4: The breakpoints window, showing our breakpoint w/ label

The breakpoints window basically shows all breakpoints along with their name (i.e. filename and position in the code, as well w/ label, conditions and hit count). Additional columns can be defined by using the menu entry “Columns”, as seen in Figure 4. Defining another label in the code, 2 lines below, will result in Figure 5. Let’s try to enter “Number” as a search term in the menu of the breakpoints window.


Figure 5: 2 Breakpoints, before search


Figure 6:  After search – our breakpoint was found

The advantage is clear: When having lots and lots of breakpoints, it will be easy to give them meaningful names, so they can be found easier afterwards.

Moreover, by right-clicking on the desired breakpoint, a context menu will open, containing the entry “Go To Source Code” (“Go To Disassembly”, respectively), allowing you to navigate directly to the position in the code, where the breakpoint is located.

The hit counters where already available in VS2008, and haven’t really changed, but for the sake of completeness they shall be named here as well. Right-clicking on a breakpoint allows you to define a hit counter for a specific breakpoint.



Figure 7: Defining hit counters for breakpoints

It means, the breakpoint will only be hit when a certain hit counter is reached. If you only want to see how many times a break point actually is passed, it is recommended to set the hit count to a very high value (that will never actually be reached). This way you can evaluate the hit counter afterwards and check for the actual value.


Figure 8: The hit count definition window

Breakpoints with conditions and/or hit counts are displayed as image. Disabled breakpoints will invert the colours.

The last new feature is the import / export of breakpoints. It is also available in the breakpoints window. The 2 buttons image are for exporting and importing, respectively, and will produce/accept an XML file containing not only the breakpoints, but also applying the search criteria you defined in the breakpoints window. This way it’s easy to reuse even your breakpoints. In a possible scenario you want to pass your breakpoints to another developer, who is working on the same project, this seems quite a handy feature.

Enjoy finding and exterminating bugs!

Best regards,


Read Full Post »