Export (0) Print
Expand All

How to: Set a Function Breakpoint

This topic applies to:

Visual Studio Edition

Visual Basic

C#

C++

J#

Web Dev

Express Edition

No

No

Yes

No

No

Standard Edition

Yes

Yes

Yes

Yes

Yes

Pro/Team Edition

Yes

Yes

Yes

Yes

Yes

You can set a breakpoint at the beginning of a function, or at a specified location within a function. For script, you can set the breakpoint only at the beginning of the function.

To insert a function breakpoint

  1. Optional: In a source window, click on the name of a function. This inserts the name of the function into the New Breakpoint dialog box so that you do not need to type it.

  2. From the Debug menu, point to New Breakpoint, and click Break at Function.

    The New Breakpoint dialog box appears.

  3. If the Function text box does not display the name of the function where you want to set the breakpoint, type the function name in the Function box and make sure the Language drop-down list shows the correct programming language for the function.

    If the function is not overloaded, only the function name is required. For overloaded functions, you can specify the arguments to set the breakpoint correctly. Type the function name followed by the parameter type names enclosed in parentheses. For example, for a C# method named A that takes an int parameter followed by a string parameter, type A(int, string).

    In native C++, you can use the context operator. (See Context Operator (C/C++ Language Expressions).)

  4. (Visual Basic, C#, and J# only) Select the Use Intellisense to verify the function name check box if you want Visual Studio IntelliSense to verify the name of the function you entered.

    If the box is checked, and what you typed does not match an overload signature, the Choose Breakpoints dialog box appears and you can choose which overloads to put the breakpoint in.

    If the check box is unselected and you type the function name, the breakpoint is put in all overloads.

    If the check box is unselected and you type in a signature that does not match, no breakpoint will be inserted into the code.

  5. The breakpoint is set at the start of the function. If you want to set the breakpoint at a different location within the function, edit the values in the Line and Character boxes.

  6. Click OK.

To insert a function breakpoint from the Breakpoints window

  1. In the Breakpoints window, click the New drop-down list and select Break at Function.

    The New Breakpoint dialog box appears.

  2. Type the function name in the Function text box and make sure the Language drop-down list shows the correct programming language for the function.

    If the function is not overloaded, only the function name is required. For overloaded functions, you can specify the arguments to set the breakpoint correctly. Type the function name followed by the parameter type names enclosed in parentheses. For example, for a C# method named A that takes an int parameter followed by a string parameter, type A(int, string).

    In native C++, you can use the context operator. (See Context Operator (C/C++ Language Expressions).)

  3. (Visual Basic, C#, and J# only) Select the Use Intellisense to verify the function name check box if you want Visual Studio IntelliSense to verify the name of the function you entered.

    If the check box is selected, and what you typed does not match an overload signature, the Choose Breakpoints dialog box appears and you can choose which overloads to insert the breakpoint in.

    If the check box is unselected and you type in only the function name, the breakpoint will be inserted in all overloads.

    If the check box is unselected and you type in a signature that does not match, no breakpoint is inserted into the code.

  4. The breakpoint is set at the start of the function. If you want to set the breakpoint at a different location within the function, edit the values in the Line and Character boxes.

  5. Click OK.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft