Function breakpoints in Visual Studio


Previously we discussed the concept of Hit Count breakpoints and Conditional breakpoints.  We will now discuss the concept of Function breakpoints. This functionality allows us to set the name of any function as the condition for the breakpoint to hit.

Let’s start by creating 2 different functions SetString() and GetString() and call them as SetString() first and then GetString(). 

Function Breakpoints in Visual Studio

To set the breakpoints for this type, go to Debug -> Windows -> Breakpoints to open the Breakpoints window. Select the option New -> Break at Function option from the window.

Function Breakpoints in Visual Studio

This open ups a new window and we specify the name of the GetString() function as the function condition for the breakpoint to be hit.

Function Breakpoints in Visual Studio

Hover the breakpoint and we can see its details.

Function Breakpoints in Visual Studio

Run the application and breakpoint will get hit only when the execution of the Getstring() function starts.

Function Breakpoints in Visual Studio

Easy and helpful, isn’t it. Happy coding…!!!

Advertisements

About Jasminder

.Net developer and blogger by profession, keen to learn new technologies, love nature, music and cricket.
This entry was posted in Tips & Tricks. Bookmark the permalink.

I have a suggestion..

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s