Condividi tramite


The Best of Visual Studio 2010: Adding labels to Breakpoints

Keyboard:  ALT + F9, L
Command:  EditorContextMenus.CodeWindow.Breakpoint.BreakpointEditlabels
Versions:  2010
Published:  1/26/2010
Code:  vstipDebug0001

Did you know that Breakpoints now support labels?  They do!  Here is how you use them:

1. Set one or more Breakpoints in your code

 

2. Open the Breakpoint window (CTRL + ALT + B)

image

3. Notice the new "Labels" column?  Just Right-Click on your Breakpoint and choose "Edit Labels" (ALT + F9, L)

image

4. You get this cool new dialog:

image

5. You can type in one (or more) labels for the Breakpoint, then click OK.  You should see your labels on your Breakpoint:

image

Okay so how does this help you?  Well, first, you can now put friendly names for Breakpoints to make them easier to understand.  Second, you can sort by the label names.  And, third, you can SEARCH the labels when you have a lot of Breakpoints.

Comments

  • Anonymous
    April 18, 2010
    Very useful! Now if only the older version of VS had that feature...

  • Anonymous
    April 18, 2010
    The best part is that we export the labels and breakpoints and share it :D.

  • Anonymous
    April 18, 2010
    If I ever had enough breakpoints to label and sort them, I'd simplify my code. Aren't breakpoints temporary, anyway? Wouldn't permanent log statements work better, especially in production? Please give us an example of when you would use this feature as opposed to one of these other options. Thanks.

  • Anonymous
    April 18, 2010
    Hey Now Zain, This sounds nice & nifty. Great post, of all the content on VS10 I've seen so far I never saw this one.   Thx 4 the info, Catto