Share via


How to: Set a Function Breakpoint

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Standard

Topic applies

Topic applies

Topic applies

Topic applies

Pro and Team

Topic applies

Topic applies

Topic applies

Topic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

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 the name of a function. This inserts the name of the function into the New Breakpoint dialog box so that you do not have to type it.

  2. On the Debug menu, point to New Breakpoint, and then 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 that 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 and C# 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 selected, 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 not selected and you type the function name, the breakpoint is put in all overloads.

    If the check box is not selected 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 that 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 and C#) 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 not selected and you type in only the function name, the breakpoint will be inserted in all overloads.

    If the check box is not selected 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

Concepts

Breakpoints and Tracepoints

Reference

Context Operator (C/C++ Language Expressions)