Posts tagged 'Debugging'

Saturday, August 2, 2014

Tip 252: You Can Make the Statement Completion Window Transparent

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Wow! Hey, thank you for reading all the way to the end! About once or twice a year, whenever she writes long conference trip reports or long summary e-mail messages at work, she usually has a line at the bottom saying, "To show her appreciation to you for reading this far, she'll buy you a latte. E-mail her to receive your coupon." It's fun to see people's reactions in their replies. In lieu of espresso, her way of saying thanks is to provide you with one last tip about Visual Studio 2008.


Hold down the Ctrl key to make the statement completion window transparent. This transparency is especially useful when the statement completion window is blocking text or other code that you need to read in order to know which object or method to select. And to make the statement completion window reappear, simply release the Ctrl key.



Happy Programming! =)
Posted by Nils-Holger at 1:31 PM with 1437 comments.

Friday, August 1, 2014

Tip 7.36: You can use the Immediate Window as a glorified calculator or side-debugger within your debugger

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She found the Immediate Window especially useful when she was doing the math to automate dragging a tool window from a docked location to a docking target. She basically had to do the math to calculate a straight line between the two points in order to send the coordinates to the mouse drag functions. If she did the math incorrectly (and the inside joke here is she has a math degree), she could pull up the Immediate Window and play with the calculations over and over again without interfering with the main debugger. This means that the variables and state of the main debugger would remain the same, unless she purposefully modified a value in the Immediate Window.


Let's start off with a very simple example. Let's say that you have the basic "Hello World" console app, but you want to print out the result of some calculation. Notice how the console app just has "Hello World."



If she puts a breakpoint at the very end of this simple console app, she can bring up the Immediate Window via Debug–Windows–Immediate and do whatever she needs. Let's say she needed to use the Immediate Window as a glorified calculator. She can figure out the value of 1 + 1, as shown in this Visual C# console app.



Since we're in a console application, we can even have the value of i printed to the console window via the Immediate Window.



And now the value of 2 appears in the console window.



Happy Programming! =)
Posted by Nils-Holger at 12:46 PM with 437 comments.

Thursday, July 31, 2014

Tip 7.35: You can view numeric values in hexadecimal format in your debug windows

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The debug tool windows (Locals, Autos, and Watch window) have a context menu that includes the Hexadecimal Display command. Just in case you ever needed to see values in hexadecimal, you now know how to do it.



Happy Programming! =)
Posted by Nils-Holger at 1:19 PM with 440 comments.

Wednesday, July 30, 2014

Tip 7.34: You can use the Watch window to quickly change a variable's value

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Have you ever been debugging some code and wanted to quickly change a variable's value without having to stop debugging? Here's what to do. Add the value to the Watch window. You can select the variable and drag it into the Watch window as shown here.



Then double-click the variable's contents within the Watch window, and you'll be able to edit.



Either click outside this field or press Enter to commit the change, and the variable will contain the new contents.



Happy Programming! =)
Posted by Nils-Holger at 12:35 PM with 444 comments.

Tuesday, July 29, 2014

Tip 7.33: How to show or prevent the Error List from appearing after a failed build

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Usually the Error List is shown (whether it is autohiding or just closed) whenever a build fails with errors. If you like using just the Output window (because you can double-click an error message in the Output window and jump to that line), here's how to prevent the Error List from appearing.

Under Tools–Options–Projects And Solutions–General, there's the Always Show Error List If Build Finishes With Errors check box. Uncheck this option to prevent the Error List from appearing after a failed build.



Happy Programming! =)
Posted by Nils-Holger at 1:38 PM with 1279 comments.

Monday, July 28, 2014

Tip 7.32: You can bind the show Errors, Warnings, and Messages buttons to keyboard shortcuts

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

In the "Tip of the Day" series on her blog, this tip was entry number 200. Considering how she blogged a new tip about Visual Studio every day, it is amazing to think what a difference a day makes. At the time of this writing, she's approaching number 300!


She's excited about this tip. Not because it is tip number 200—this was purely coincidental—but because she accidentally found it while browsing the commands in the Tools–Options–Environment–Keyboard page that contained the word Error.

Go to Tools–Options–Environment–Keyboard, and search for Errors. You'll notice that this odd Errors command will stare back at you.



She says this "odd" command because usually Visual Studio commands have the canonical name format of <word>.<word>. This obviously caught her eye, so she contacted the developer for confirmation.

These commands toggle the Errors, Warnings, and Messages shown on the Error List, so you can bind them to keyboard shortcuts.



For example, you could bind the following commands to the keyboard shortcuts shown:
  • Errors: Ctrl+Alt+Shift+E
  • Warnings: Ctrl+Alt+Shift+W
  • Messages: Ctrl+Alt+Shift+M


Now, instead of clicking the buttons, you can just use the keyboard shortcut. Pretty cool.

Happy Programming! =)
Posted by Nils-Holger at 12:57 PM with 432 comments.

Sunday, July 27, 2014

Tip 7.31: You can do multicolumn sorting (secondary sort, and so forth) in both the Error List and the Task List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Both the Error List and the Task List have support for multicolumn sorting, such as secondary sort and tertiary sort.

For example, suppose you want to sort all tasks (or errors) by file first and then by line number so that you can go through each file in the order in which the tasks (or errors) appear.

To do a secondary sort, follow these steps:

  1. Click the column that you want to have as the primary sort (such as File).
  2. Shift+Click on the column you want to have as a secondary sort (such as Line number).
  3. Rinse and repeat for other columns.
For the Error List, you can see how things are sorted first by File and then by Line number.



Happy Programming! =)
Posted by Nils-Holger at 12:00 PM with 442 comments.

Saturday, July 26, 2014

Tip 7.30: You can view an error's documentation directly from the Error List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



If you right-click an error in the Error List view, you'll see a context menu pop up with the Show Error Help option.



Clicking this command launches the external documentation viewer, also known as dexplorer in some social circles, to that specific error.



Happy Programming! =)
Posted by Nils-Holger at 2:39 PM with 432 comments.

Friday, July 25, 2014

Tip 7.29: How to customize your Error List view

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This was one of her least favorite designs in the IDE. When the Error List was split from the Task List in Visual Studio 2005, a row of buttons was put on the top of the Error List for users to customize whether they wanted to see just Errors, Warnings, or Messages. But, then again, it enables her to show you cool tips like Tip 7.32.


For example, here's the default with everything enabled.



And now, here's the Error List with nothing enabled, for dramatic effect.



Happy Programming! =)
Posted by Nils-Holger at 12:51 PM with 626 comments.

Thursday, July 24, 2014

Tip 7.28: You can use Ctrl+Shift+F12 to view the next error listed in the Error List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The keyboard binding is Ctrl+Shift+F12, and the command is View.NextError. She's a little surprised that there isn't a default keyboard shortcut for View.PreviousError. But you can always add one yourself.



And, of course, the status bar tries to be helpful by showing you the error you have navigated to. =)



Happy Programming! =)
Posted by Nils-Holger at 1:08 PM with 435 comments.

Wednesday, July 23, 2014

Tip 7.27: How to have all processes break when one process breaks

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In Tools–Options–Debugging–General, there's the option Break All Processes When One Process Breaks.

Let's say you are debugging multiple projects, and you want to configure what happens when one process breaks.



For example, let's say she has two console applications running in an infinite loop. On the second console application, she breaks the process. If she has checked the Break All Processes When One Process Breaks check box, the first console application will break also.

And, of course, you can uncheck this option to have the first console application keep going.

Happy Programming! =)
Posted by Nils-Holger at 12:50 PM with 447 comments.

Tuesday, July 22, 2014

Tip 7.26: You can start debugging multiple projects

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This tip marked the one-year anniversary of doing the "Tip of the Day" series. She considers July 27, 2007, as the kick-off date of "Tip of the Day." Wow, what a difference a post a day makes! Thanks to everyone who has been reading the series. It's been an extremely rewarding experience to see these tips help people. And she also wants to express her thanks for all the motivation you have given her to continue writing. It takes her on the average 20 to 30 minutes to decide what tip to write, to capture the screen shots, and to add it to the queue. She refuses to do the math to see just how many puppies she could have potty-trained by now. She just doesn't want to know. =D


Right-click the solution in the Solution Explorer, and select Properties. Go to the Common Properties–Startup Project page. (It's the first page in the dialog box.)

You'll see three option buttons:
  • Current Selection This option selects whichever project had the inactive selection (that is, whichever project was selected previously) when you went to the Solution Property Pages.
  • Single Startup Project Usually this is the first project you had in the solution, or it's the project that you manually set as the startup project.
  • Multiple Startup Projects And there was great joy! When this option is enabled, you can pick and choose which projects to start (and make sure you choose Start and not Start Without Debugging).




And using the preceding example, when she hits F5, she gets the following.



Happy Programming! =)
Posted by Nils-Holger at 12:53 PM with 438 comments.

Monday, July 21, 2014

Tip 7.25: How to select the startup project from the Solution Explorer

"Visual Studio Tips, 251 ways to improve your Productivity" in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are two ways you can select a project as the startup project when you have more than one project in your solution.

The first way is via the Solution Property pages. Right-click the solution node in the Solution Explorer, and under Common Properties–Startup Project, you can choose Single Startup Project. Now you can select which project you want.



The second way is to right-click the project and select the Set As StartUp Project command from the context menu.



The startup project appears in bold in the Solution Explorer.



Happy Programming! =)
Posted by Nils-Holger at 12:27 PM with 440 comments.

Sunday, July 20, 2014

Tip 7.24: You can use DataTips to edit a variable's content

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Whenever you are debugging and want to change the contents of a variable, you can drag the variable into the Watch window. But you can also use DataTips to change the variable without leaving the editor.

Hover over a variable when you have hit a breakpoint. You'll notice a glorified ToolTip appear. This is actually a DataTip. You can click the value of the variable to go into an edit mode. Change the contents of the variable, and press Enter to commit.



If you have the Autos window open, you'll notice the color change, implying the commit was successful.



Happy Programming! =)
Posted by Nils-Holger at 11:32 AM with 439 comments.

Saturday, July 19, 2014

Tip 7.23: You can disable the warning message before you delete all breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The previous tip talked about how to delete all breakpoints. If you are following along at home, you have encountered the warning message that appears when you attempt to do this.



If you find it annoying, you can disable it by going to Tools–Options–Debugging–General and unchecking the Ask Before Deleting All Breakpoints option.



Happy Programming! =)
Posted by Nils-Holger at 2:29 PM with 434 comments.

Friday, July 18, 2014

Tip 7.22: You can press Ctrl+Shift+F9 to delete all breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can press Ctrl+Shift+F9, bound to Debug.DeleteAllBreakpoints, to delete all the breakpoints you've created in your solution. The command is found under the Debug menu.

vstip7220

The option is also found on the Breakpoints window in the toolbar.

vstip7220a

Happy Programming! =)
Posted by Nils-Holger at 2:02 PM with 445 comments.

Thursday, July 17, 2014

Tip 7.21: You can press Ctrl+Alt+B to open the Breakpoints window

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Under Debug–Windows, you'll find the Breakpoints window.

vstip7210

The keyboard shortcut is Ctrl+Alt+B, which is bound to the command Debug.Breakpoints.

vstip7210a

Happy Programming! =)
Posted by Nils-Holger at 12:42 PM with 448 comments.

Wednesday, July 16, 2014

Tip 7.20: You can press Ctrl+B to set a breakpoint at the desired function

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In case you want to set a breakpoint at a given function, and not at the current line, you don't have to search for the function name and then hit F9. Instead, you can press Ctrl+B to run the Break At Function command.

vstip7200

This command brings up the New Breakpoint window.

vstip7200a

Here you can type the name of the function you want to set a new breakpoint at.

Happy Programming! =)
Posted by Nils-Holger at 12:04 PM with 781 comments.

Tuesday, July 15, 2014

Tip 7.19: You can use breakpoint filters to break the right process

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Conditional breakpoints are for breaking at the expression level, when a particular condition is true, like x = 5. But what if you have multiple instances of the same app running? How do you set to break the instance you want?

The answer is breakpoint filters.

Go to Tools–Options–Debugging–General, and you'll see the option Enable Breakpoint Filters.

vstip7190

Set a breakpoint and right-click to bring up the context menu.

vstip7190a

In the Breakpoint Filter dialog box, you can specify when to break. The next image shows breaking a process by its process ID.

vstip7190b

And you can verify the breakpoint filter in the Breakpoints window under the Filter column.

vstip7190c

Happy Programming! =)
Posted by Nils-Holger at 3:03 PM with 433 comments.

Monday, July 14, 2014

Tip 7.18: You can set conditional breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



When you want to break only under certain conditions, you can right-click a breakpoint red circle (or go to the Breakpoints window and bring up the context menu on a given breakpoint) and select Condition to bring up the dialog box for conditional breakpoints.

vstip7180

You're given two options: break only when the specified expression is true, or break only when the specified value has changed. For this example, because she's in a for loop, she'll break when the value of i is greater than 5.

vstip7180a

You'll notice that the breakpoint circle now has a red plus on it to indicate it is conditional.

vstip7180b

Happy Programming! =)
Posted by Nils-Holger at 12:25 PM with 439 comments.

Monday, July 14, 2014

Tip 7.17: You can use Ctrl+F9 to enable or disable a breakpoint

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She didn't see this command under the Debug menu. So, in case you want to use the keyboard to enable or disable a breakpoint, you can press Ctrl+F9, which is bound to the command Debug.EnabledBreakpoint. Note that you won't find a Debug.DisableBreakpoint because this is handled by the enabled command.

vstip7170

A disabled breakpoint still gets saved in your Breakpoints window, even though it will not get hit during debugging.

vstip7170a

Happy Programming! =)
Posted by Nils-Holger at 12:05 PM with 433 comments.

Saturday, July 12, 2014

Tip 7.16: You can press F9 to set a breakpoint on the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The command Debug.ToggleBreakpoint sets (or deletes) the breakpoint on the current line, in case you don't want to take your hands off the keyboard.

vstip7160

Happy Programming! =)
Posted by Nils-Holger at 2:05 PM with 445 comments.

Friday, July 11, 2014

Tip 7.15: You can set a breakpoint by clicking the indicator margin

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She's very big into starting off with the basics, just in case someone reading this didn't know about this tip.
You can set a breakpoint on any applicable line by clicking the indicator margin, as illustrated here.

vstip7150

Clicking here inserts the breakpoint, as shown next.

vstip7150a

Happy Programming!
Posted by Nils-Holger at 11:13 AM with 449 comments.

Friday, November 22, 2013

Tip 252: You Can Make the Statement Completion Window Transparent

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog





Sara Aside

Wow! Hey, thank you for reading all the way to the end! About once or twice a year, whenever she writes long conference trip reports or long summary e-mail messages at work, she usually has a line at the bottom saying, "To show her appreciation to you for reading this far, she'll buy you a latte. E-mail her to receive your coupon." It's fun to see people's reactions in their replies. In lieu of espresso, her way of saying thanks is to provide you with one last tip about Visual Studio 2008.


Hold down the Ctrl key to make the statement completion window transparent. This transparency is especially useful when the statement completion window is blocking text or other code that you need to read in order to know which object or method to select. And to make the statement completion window reappear, simply release the Ctrl key.



Happy Programming! =)
Posted by Nils-Holger at 12:52 PM with 442 comments.

Thursday, November 21, 2013

Tip 7.36: You can use the Immediate Window as a glorified calculator or side-debugger within your debugger

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She found the Immediate Window especially useful when she was doing the math to automate dragging a tool window from a docked location to a docking target. She basically had to do the math to calculate a straight line between the two points in order to send the coordinates to the mouse drag functions. If she did the math incorrectly (and the inside joke here is she has a math degree), she could pull up the Immediate Window and play with the calculations over and over again without interfering with the main debugger. This means that the variables and state of the main debugger would remain the same, unless she purposefully modified a value in the Immediate Window.
Let's start off with a very simple example. Let's say that you have the basic "Hello World" console app, but you want to print out the result of some calculation. Notice how the console app just has "Hello World."



If she puts a breakpoint at the very end of this simple console app, she can bring up the Immediate Window via Debug–Windows–Immediate and do whatever she needs. Let's say she needed to use the Immediate Window as a glorified calculator. She can figure out the value of 1 + 1, as shown in this Visual C# console app.



Since we're in a console application, we can even have the value of i printed to the console window via the Immediate Window.



And now the value of 2 appears in the console window.



Happy Programming! =)
Posted by Nils-Holger at 12:32 PM with 351 comments.

Wednesday, November 20, 2013

Tip 7.35: You can view numeric values in hexadecimal format in your debug windows

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The debug tool windows (Locals, Autos, and Watch window) have a context menu that includes the Hexadecimal Display command. Just in case you ever needed to see values in hexadecimal, you now know how to do it.



Happy Programming! =)
Posted by Nils-Holger at 12:20 PM with 448 comments.

Tuesday, November 19, 2013

Tip 7.34: You can use the Watch window to quickly change a variable's value

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Have you ever been debugging some code and wanted to quickly change a variable's value without having to stop debugging? Here's what to do. Add the value to the Watch window. You can select the variable and drag it into the Watch window as shown here.



Then double-click the variable's contents within the Watch window, and you'll be able to edit.



Either click outside this field or press Enter to commit the change, and the variable will contain the new contents.



Happy Programming! =)
Posted by Nils-Holger at 11:54 AM with 438 comments.

Monday, November 18, 2013

Tip 7.33: How to show or prevent the Error List from appearing after a failed build

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Usually the Error List is shown (whether it is autohiding or just closed) whenever a build fails with errors. If you like using just the Output window (because you can double-click an error message in the Output window and jump to that line), here's how to prevent the Error List from appearing. Under Tools–Options–Projects And Solutions–General, there's the Always Show Error List If Build Finishes With Errors check box. Uncheck this option to prevent the Error List from appearing after a failed build.



Happy Programming! =)
Posted by Nils-Holger at 12:11 PM with 475 comments.

Sunday, November 17, 2013

Tip 7.32: You can bind the show Errors, Warnings, and Messages buttons to keyboard shortcuts

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

In the "Tip of the Day" series on her blog, this tip was entry number 200. Considering how she blogged a new tip about Visual Studio every day, it is amazing to think what a difference a day makes. At the time of this writing, she's approaching number 300!
She's excited about this tip. Not because it is tip number 200—this was purely coincidental—but because she accidentally found it while browsing the commands in the Tools–Options–Environment–Keyboard page that contained the word Error. Go to Tools–Options–Environment–Keyboard, and search for Errors. You'll notice that this odd Errors command will stare back at you.



She says this "odd" command because usually Visual Studio commands have the canonical name format of <word>.<word>. This obviously caught her eye, so she contacted the developer for confirmation. These commands toggle the Errors, Warnings, and Messages shown on the Error List, so you can bind them to keyboard shortcuts.



For example, you could bind the following commands to the keyboard shortcuts shown:
  • Errors: Ctrl+Alt+Shift+E
  • Warnings: Ctrl+Alt+Shift+W
  • Messages: Ctrl+Alt+Shift+M
Now, instead of clicking the buttons, you can just use the keyboard shortcut. Pretty cool.

Happy Programming! =)
Posted by Nils-Holger at 12:34 PM with 443 comments.

Saturday, November 16, 2013

Tip 7.31: You can do multicolumn sorting (secondary sort, and so forth) in both the Error List and the Task List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Both the Error List and the Task List have support for multicolumn sorting, such as secondary sort and tertiary sort. For example, suppose you want to sort all tasks (or errors) by file first and then by line number so that you can go through each file in the order in which the tasks (or errors) appear.

To do a secondary sort, follow these steps:
  1. Click the column that you want to have as the primary sort (such as File).
  2. Shift+Click on the column you want to have as a secondary sort (such as Line number).
  3. Rinse and repeat for other columns.
For the Error List, you can see how things are sorted first by File and then by Line number.



Happy Programming! =)
Posted by Nils-Holger at 12:23 PM with 445 comments.

Friday, November 15, 2013

Tip 7.30: You can view an error's documentation directly from the Error List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



If you right-click an error in the Error List view, you'll see a context menu pop up with the Show Error Help option.



Clicking this command launches the external documentation viewer, also known as dexplorer in some social circles, to that specific error.



Happy Programming! =)
Posted by Nils-Holger at 11:03 AM with 0 comments.

Thursday, November 14, 2013

Tip 7.29: How to customize your Error List view

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This was one of her least favorite designs in the IDE. When the Error List was split from the Task List in Visual Studio 2005, a row of buttons was put on the top of the Error List for users to customize whether they wanted to see just Errors, Warnings, or Messages. But, then again, it enables her to show you cool tips like Tip 7.32.
For example, here's the default with everything enabled.



And now, here's the Error List with nothing enabled, for dramatic effect.



Happy Programming! =)
Posted by Nils-Holger at 12:59 PM with 442 comments.

Wednesday, November 13, 2013

Tip 7.28: You can use Ctrl+Shift+F12 to view the next error listed in the Error List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The keyboard binding is Ctrl+Shift+F12, and the command is View.NextError. She's a little surprised that there isn't a default keyboard shortcut for View.PreviousError. But you can always add one yourself.



And, of course, the status bar tries to be helpful by showing you the error you have navigated to. =)



Happy Programming! =)
Posted by Nils-Holger at 11:56 AM with 437 comments.

Tuesday, November 12, 2013

Tip 7.27: How to have all processes break when one process breaks

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In Tools–Options–Debugging–General, there's the option Break All Processes When One Process Breaks. Let's say you are debugging multiple projects, and you want to configure what happens when one process breaks.



For example, let's say she has two console applications running in an infinite loop. On the second console application, she breaks the process. If she has checked the Break All Processes When One Process Breaks check box, the first console application will break also. And, of course, you can uncheck this option to have the first console application keep going.

Happy Programming! =)
Posted by Nils-Holger at 1:08 PM with 441 comments.

Monday, November 11, 2013

Tip 7.26: You can start debugging multiple projects

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This tip marked the one-year anniversary of doing the "Tip of the Day" series. She considers July 27, 2007, as the kick-off date of "Tip of the Day." Wow, what a difference a post a day makes! Thanks to everyone who has been reading the series. It's been an extremely rewarding experience to see these tips help people. And she also wants to express her thanks for all the motivation you have given her to continue writing. It takes her on the average 20 to 30 minutes to decide what tip to write, to capture the screen shots, and to add it to the queue. She refuses to do the math to see just how many puppies she could have potty-trained by now. She just doesn't want to know. =D


Right-click the solution in the Solution Explorer, and select Properties. Go to the Common Properties–Startup Project page. (It's the first page in the dialog box.) You'll see three option buttons:
  • Current Selection This option selects whichever project had the inactive selection (that is, whichever project was selected previously) when you went to the Solution Property Pages.
  • Single Startup Project Usually this is the first project you had in the solution, or it's the project that you manually set as the startup project.
  • Multiple Startup Projects And there was great joy! When this option is enabled, you can pick and choose which projects to start (and make sure you choose Start and not Start Without Debugging).




And using the preceding example, when she hits F5, she gets the following.



Happy Programming! =)
Posted by Nils-Holger at 12:26 PM with 433 comments.

Sunday, November 10, 2013

Tip 7.25: How to select the startup project from the Solution Explorer

"Visual Studio Tips, 251 ways to improve your Productivity" in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are two ways you can select a project as the startup project when you have more than one project in your solution. The first way is via the Solution Property pages. Right-click the solution node in the Solution Explorer, and under Common Properties–Startup Project, you can choose Single Startup Project. Now you can select which project you want.



The second way is to right-click the project and select the Set As StartUp Project command from the context menu.



The startup project appears in bold in the Solution Explorer.



Happy Programming! =)
Posted by Nils-Holger at 1:28 PM with 494 comments.

Saturday, November 9, 2013

Tip 7.24: You can use DataTips to edit a variable's content

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Whenever you are debugging and want to change the contents of a variable, you can drag the variable into the Watch window. But you can also use DataTips to change the variable without leaving the editor. Hover over a variable when you have hit a breakpoint. You'll notice a glorified ToolTip appear. This is actually a DataTip. You can click the value of the variable to go into an edit mode. Change the contents of the variable, and press Enter to commit.



If you have the Autos window open, you'll notice the color change, implying the commit was successful.



Happy Programming! =)
Posted by Nils-Holger at 12:51 PM with 443 comments.

Friday, November 8, 2013

Tip 7.23: You can disable the warning message before you delete all breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The previous tip talked about how to delete all breakpoints. If you are following along at home, you have encountered the warning message that appears when you attempt to do this.



If you find it annoying, you can disable it by going to Tools–Options–Debugging–General and unchecking the Ask Before Deleting All Breakpoints option.



Happy Programming! =)
Posted by Nils-Holger at 12:58 PM with 440 comments.

Thursday, November 7, 2013

Tip 7.22: You can press Ctrl+Shift+F9 to delete all breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can press Ctrl+Shift+F9, bound to Debug.DeleteAllBreakpoints, to delete all the breakpoints you've created in your solution. The command is found under the Debug menu.

vstip7220

The option is also found on the Breakpoints window in the toolbar.

vstip7220a

Happy Programming! =)
Posted by Nils-Holger at 1:06 PM with 442 comments.

Wednesday, November 6, 2013

Tip 7.21: You can press Ctrl+Alt+B to open the Breakpoints window

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Under Debug–Windows, you'll find the Breakpoints window.

vstip7210

The keyboard shortcut is Ctrl+Alt+B, which is bound to the command Debug.Breakpoints.

vstip7210a

Happy Programming! =)
Posted by Nils-Holger at 12:44 PM with 441 comments.

Tuesday, November 5, 2013

Tip 7.20: You can press Ctrl+B to set a breakpoint at the desired function

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In case you want to set a breakpoint at a given function, and not at the current line, you don't have to search for the function name and then hit F9. Instead, you can press Ctrl+B to run the Break At Function command.

vstip7200

This command brings up the New Breakpoint window.

vstip7200a

Here you can type the name of the function you want to set a new breakpoint at. Happy Programming! =)
Posted by Nils-Holger at 12:23 PM with 686 comments.

Monday, November 4, 2013

Tip 7.19: You can use breakpoint filters to break the right process

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Conditional breakpoints are for breaking at the expression level, when a particular condition is true, like x = 5. But what if you have multiple instances of the same app running? How do you set to break the instance you want? The answer is breakpoint filters. Go to Tools–Options–Debugging–General, and you'll see the option Enable Breakpoint Filters.

vstip7190

Set a breakpoint and right-click to bring up the context menu.

vstip7190a

In the Breakpoint Filter dialog box, you can specify when to break. The next image shows breaking a process by its process ID.

vstip7190b

And you can verify the breakpoint filter in the Breakpoints window under the Filter column.

vstip7190c

Happy Programming! =)
Posted by Nils-Holger at 12:33 PM with 448 comments.

Sunday, November 3, 2013

Tip 7.18: You can set conditional breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



When you want to break only under certain conditions, you can right-click a breakpoint red circle (or go to the Breakpoints window and bring up the context menu on a given breakpoint) and select Condition to bring up the dialog box for conditional breakpoints.

vstip7180

You're given two options: break only when the specified expression is true, or break only when the specified value has changed. For this example, because she's in a for loop, she'll break when the value of i is greater than 5.

vstip7180a

You'll notice that the breakpoint circle now has a red plus on it to indicate it is conditional.

vstip7180b

Happy Programming! =)
Posted by Nils-Holger at 12:23 PM with 448 comments.

Saturday, November 2, 2013

Tip 7.17: You can use Ctrl+F9 to enable or disable a breakpoint

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She didn't see this command under the Debug menu. So, in case you want to use the keyboard to enable or disable a breakpoint, you can press Ctrl+F9, which is bound to the command Debug.EnabledBreakpoint. Note that you won't find a Debug.DisableBreakpoint because this is handled by the enabled command.

vstip7170

A disabled breakpoint still gets saved in your Breakpoints window, even though it will not get hit during debugging.

vstip7170a

Happy Programming! =)
Posted by Nils-Holger at 2:08 PM with 439 comments.

Friday, November 1, 2013

Tip 7.16: You can press F9 to set a breakpoint on the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The command Debug.ToggleBreakpoint sets (or deletes) the breakpoint on the current line, in case you don't want to take your hands off the keyboard.

vstip7160

Happy Programming! =)
Posted by Nils-Holger at 1:17 PM with 64 comments.

Thursday, October 31, 2013

Tip 7.15: You can set a breakpoint by clicking the indicator margin

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She's very big into starting off with the basics, just in case someone reading this didn't know about this tip.
You can set a breakpoint on any applicable line by clicking the indicator margin, as illustrated here.

vstip7150

Clicking here inserts the breakpoint, as shown next.

vstip7150a

Happy Programming!
Posted by Nils-Holger at 2:00 PM with 509 comments.

Wednesday, October 30, 2013

Tip 7.14: You can use tracepoints to log PrintF() or Console.WriteLine() info without editing your code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Right-click in the editor wherever you want to insert a tracepoint, select Breakpoint, and then select Insert Tracepoint.

vstip7140

This brings up the tracepoint dialog box, which gives you some helpful default settings. But for this example, the really helpful default is in the descriptive text for logging the contents of a variable.

vstip7140a

You'll notice that the editor shows a diamond instead of a circle.

vstip7140b

And the tracepoints are logged in the Output window's Debug pane.

vstip7140c

Happy Programming! =)
Posted by Nils-Holger at 1:28 PM with 512 comments.

Friday, March 8, 2013

Tip 7.36: You can use the Immediate Window as a glorified calculator or side-debugger within your debugger

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She found the Immediate Window especially useful when she was doing the math to automate dragging a tool window from a docked location to a docking target. She basically had to do the math to calculate a straight line between the two points in order to send the coordinates to the mouse drag functions. If she did the math incorrectly (and the inside joke here is she has a math degree), she could pull up the Immediate Window and play with the calculations over and over again without interfering with the main debugger. This means that the variables and state of the main debugger would remain the same, unless she purposefully modified a value in the Immediate Window.
Let's start off with a very simple example. Let's say that you have the basic "Hello World" console app, but you want to print out the result of some calculation. Notice how the console app just has "Hello World."



If she puts a breakpoint at the very end of this simple console app, she can bring up the Immediate Window via Debug–Windows–Immediate and do whatever she needs. Let's say she needed to use the Immediate Window as a glorified calculator. She can figure out the value of 1 + 1, as shown in this Visual C# console app.



Since we're in a console application, we can even have the value of i printed to the console window via the Immediate Window.



And now the value of 2 appears in the console window.



Happy Programming! =)
Posted by Nils-Holger at 1:49 PM with 443 comments.

Thursday, March 7, 2013

Tip 7.35: You can view numeric values in hexadecimal format in your debug windows

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The debug tool windows (Locals, Autos, and Watch window) have a context menu that includes the Hexadecimal Display command. Just in case you ever needed to see values in hexadecimal, you now know how to do it.



Happy Programming! =)
Posted by Nils-Holger at 1:23 PM with 439 comments.

Wednesday, March 6, 2013

Tip 7.34: You can use the Watch window to quickly change a variable's value

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Have you ever been debugging some code and wanted to quickly change a variable's value without having to stop debugging? Here's what to do. Add the value to the Watch window. You can select the variable and drag it into the Watch window as shown here.



Then double-click the variable's contents within the Watch window, and you'll be able to edit.



Either click outside this field or press Enter to commit the change, and the variable will contain the new contents.



Happy Programming! =)
Posted by Nils-Holger at 1:53 PM with 438 comments.

Tuesday, March 5, 2013

Tip 7.33: How to show or prevent the Error List from appearing after a failed build

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Usually the Error List is shown (whether it is autohiding or just closed) whenever a build fails with errors. If you like using just the Output window (because you can double-click an error message in the Output window and jump to that line), here's how to prevent the Error List from appearing. Under Tools–Options–Projects And Solutions–General, there's the Always Show Error List If Build Finishes With Errors check box. Uncheck this option to prevent the Error List from appearing after a failed build.



Happy Programming! =)
Posted by Nils-Holger at 2:09 PM with 438 comments.

Monday, March 4, 2013

Tip 7.32: You can bind the show Errors, Warnings, and Messages buttons to keyboard shortcuts

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

In the "Tip of the Day" series on her blog, this tip was entry number 200. Considering how she blogged a new tip about Visual Studio every day, it is amazing to think what a difference a day makes. At the time of this writing, she's approaching number 300!
She's excited about this tip. Not because it is tip number 200—this was purely coincidental—but because she accidentally found it while browsing the commands in the Tools–Options–Environment–Keyboard page that contained the word Error. Go to Tools–Options–Environment–Keyboard, and search for Errors. You'll notice that this odd Errors command will stare back at you.



She says this "odd" command because usually Visual Studio commands have the canonical name format of <word>.<word>. This obviously caught her eye, so she contacted the developer for confirmation. These commands toggle the Errors, Warnings, and Messages shown on the Error List, so you can bind them to keyboard shortcuts.



For example, you could bind the following commands to the keyboard shortcuts shown:
  • Errors: Ctrl+Alt+Shift+E
  • Warnings: Ctrl+Alt+Shift+W
  • Messages: Ctrl+Alt+Shift+M
Now, instead of clicking the buttons, you can just use the keyboard shortcut. Pretty cool.

Happy Programming! =)
Posted by Nils-Holger at 12:17 PM with 440 comments.

Sunday, March 3, 2013

Tip 7.31: You can do multicolumn sorting (secondary sort, and so forth) in both the Error List and the Task List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Both the Error List and the Task List have support for multicolumn sorting, such as secondary sort and tertiary sort. For example, suppose you want to sort all tasks (or errors) by file first and then by line number so that you can go through each file in the order in which the tasks (or errors) appear. To do a secondary sort, follow these steps:
  1. Click the column that you want to have as the primary sort (such as File).
  2. Shift+Click on the column you want to have as a secondary sort (such as Line number).
  3. Rinse and repeat for other columns.
For the Error List, you can see how things are sorted first by File and then by Line number.



Happy Programming! =)
Posted by Nils-Holger at 12:58 PM with 440 comments.

Saturday, March 2, 2013

Tip 7.30: You can view an error's documentation directly from the Error List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of  'Sara Ford'

Sara Ford's Blog



If you right-click an error in the Error List view, you'll see a context menu pop up with the Show Error Help option.



Clicking this command launches the external documentation viewer, also known as dexplorer in some social circles, to that specific error.



Happy Programming! =)
Posted by Nils-Holger at 12:01 PM with 2186 comments.

Friday, March 1, 2013

Tip 7.29: How to customize your Error List view

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This was one of her least favorite designs in the IDE. When the Error List was split from the Task List in Visual Studio 2005, a row of buttons was put on the top of the Error List for users to customize whether they wanted to see just Errors, Warnings, or Messages. But, then again, it enables her to show you cool tips like Tip 7.32.


For example, here's the default with everything enabled.



And now, here's the Error List with nothing enabled, for dramatic effect.



Happy Programming! =)
Posted by Nils-Holger at 11:58 AM with 465 comments.

Thursday, February 28, 2013

Tip 7.28: You can use Ctrl+Shift+F12 to view the next error listed in the Error List

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The keyboard binding is Ctrl+Shift+F12, and the command is View.NextError. She's a little surprised that there isn't a default keyboard shortcut for View.PreviousError. But you can always add one yourself.



And, of course, the status bar tries to be helpful by showing you the error you have navigated to. =)



Happy Programming! =)
Posted by Nils-Holger at 12:35 PM with 507 comments.

Wednesday, February 27, 2013

Tip 7.27: How to have all processes break when one process breaks

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In Tools–Options–Debugging–General, there's the option Break All Processes When One Process Breaks. Let's say you are debugging multiple projects, and you want to configure what happens when one process breaks.



For example, let's say she has two console applications running in an infinite loop. On the second console application, she breaks the process. If she has checked the Break All Processes When One Process Breaks check box, the first console application will break also. And, of course, you can uncheck this option to have the first console application keep going.

Happy Programming! =)
Posted by Nils-Holger at 12:44 PM with 508 comments.

Wednesday, February 27, 2013

Tip 7.26: You can start debugging multiple projects

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

This tip marked the one-year anniversary of doing the "Tip of the Day" series. She considers July 27, 2007, as the kick-off date of "Tip of the Day." Wow, what a difference a post a day makes! Thanks to everyone who has been reading the series. It's been an extremely rewarding experience to see these tips help people. And she also wants to express her thanks for all the motivation you have given her to continue writing. It takes her on the average 20 to 30 minutes to decide what tip to write, to capture the screen shots, and to add it to the queue. She refuses to do the math to see just how many puppies she could have potty-trained by now. She just doesn't want to know. =D


Right-click the solution in the Solution Explorer, and select Properties. Go to the Common Properties–Startup Project page. (It's the first page in the dialog box.) You'll see three option buttons:
  • Current Selection This option selects whichever project had the inactive selection (that is, whichever project was selected previously) when you went to the Solution Property Pages.
  • Single Startup Project Usually this is the first project you had in the solution, or it's the project that you manually set as the startup project.
  • Multiple Startup Projects And there was great joy! When this option is enabled, you can pick and choose which projects to start (and make sure you choose Start and not Start Without Debugging).




And using the preceding example, when she hits F5, she gets the following.



Happy Programming! =)
Posted by Nils-Holger at 5:24 AM with 506 comments.

Monday, February 25, 2013

Tip 7.25: How to select the startup project from the Solution Explorer

"Visual Studio Tips, 251 ways to improve your Productivity" in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



There are two ways you can select a project as the startup project when you have more than one project in your solution. The first way is via the Solution Property pages. Right-click the solution node in the Solution Explorer, and under Common Properties–Startup Project, you can choose Single Startup Project. Now you can select which project you want.



The second way is to right-click the project and select the Set As StartUp Project command from the context menu.



The startup project appears in bold in the Solution Explorer.



Happy Programming! =)
Posted by Nils-Holger at 1:39 PM with 437 comments.

Sunday, February 24, 2013

Tip 7.24: You can use DataTips to edit a variable's content

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Whenever you are debugging and want to change the contents of a variable, you can drag the variable into the Watch window. But you can also use DataTips to change the variable without leaving the editor. Hover over a variable when you have hit a breakpoint. You'll notice a glorified ToolTip appear. This is actually a DataTip. You can click the value of the variable to go into an edit mode. Change the contents of the variable, and press Enter to commit.



If you have the Autos window open, you'll notice the color change, implying the commit was successful.



Happy Programming! =)
Posted by Nils-Holger at 12:11 PM with 472 comments.

Saturday, February 23, 2013

Tip 7.23: You can disable the warning message before you delete all breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The previous tip talked about how to delete all breakpoints. If you are following along at home, you have encountered the warning message that appears when you attempt to do this.



If you find it annoying, you can disable it by going to Tools–Options–Debugging–General and unchecking the Ask Before Deleting All Breakpoints option.



Happy Programming! =)
Posted by Nils-Holger at 12:39 PM with 436 comments.

Friday, February 22, 2013

Tip 7.22: You can press Ctrl+Shift+F9 to delete all breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can press Ctrl+Shift+F9, bound to Debug.DeleteAllBreakpoints, to delete all the breakpoints you've created in your solution. The command is found under the Debug menu.

vstip7220

The option is also found on the Breakpoints window in the toolbar.

vstip7220a

Happy Programming! =)
Posted by Nils-Holger at 12:03 PM with 713 comments.

Thursday, February 21, 2013

Tip 7.21: You can press Ctrl+Alt+B to open the Breakpoints window

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Under Debug–Windows, you'll find the Breakpoints window.

vstip7210

The keyboard shortcut is Ctrl+Alt+B, which is bound to the command Debug.Breakpoints.

vstip7210a

Happy Programming! =)
Posted by Nils-Holger at 1:47 PM with 629 comments.

Wednesday, February 20, 2013

Tip 7.20: You can press Ctrl+B to set a breakpoint at the desired function

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In case you want to set a breakpoint at a given function, and not at the current line, you don't have to search for the function name and then hit F9. Instead, you can press Ctrl+B to run the Break At Function command.

vstip7200

This command brings up the New Breakpoint window.

vstip7200a

Here you can type the name of the function you want to set a new breakpoint at. Happy Programming! =)
Posted by Nils-Holger at 12:32 PM with 720 comments.

Tuesday, February 19, 2013

Tip 7.19: You can use breakpoint filters to break the right process

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Conditional breakpoints are for breaking at the expression level, when a particular condition is true, like x = 5. But what if you have multiple instances of the same app running? How do you set to break the instance you want? The answer is breakpoint filters. Go to Tools–Options–Debugging–General, and you'll see the option Enable Breakpoint Filters.

vstip7190

Set a breakpoint and right-click to bring up the context menu.

vstip7190a

In the Breakpoint Filter dialog box, you can specify when to break. The next image shows breaking a process by its process ID.

vstip7190b

And you can verify the breakpoint filter in the Breakpoints window under the Filter column.

vstip7190c

Happy Programming! =)
Posted by Nils-Holger at 1:23 PM with 292 comments.

Monday, February 18, 2013

Tip 7.18: You can set conditional breakpoints

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



When you want to break only under certain conditions, you can right-click a breakpoint red circle (or go to the Breakpoints window and bring up the context menu on a given breakpoint) and select Condition to bring up the dialog box for conditional breakpoints.

vstip7180

You're given two options: break only when the specified expression is true, or break only when the specified value has changed. For this example, because she's in a for loop, she'll break when the value of i is greater than 5.

vstip7180a

You'll notice that the breakpoint circle now has a red plus on it to indicate it is conditional.

vstip7180b

Happy Programming! =)
Posted by Nils-Holger at 1:29 PM with 442 comments.

Sunday, February 17, 2013

Tip 7.17: You can use Ctrl+F9 to enable or disable a breakpoint

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She didn't see this command under the Debug menu. So, in case you want to use the keyboard to enable or disable a breakpoint, you can press Ctrl+F9, which is bound to the command Debug.EnabledBreakpoint. Note that you won't find a Debug.DisableBreakpoint because this is handled by the enabled command.

vstip7170

A disabled breakpoint still gets saved in your Breakpoints window, even though it will not get hit during debugging.

vstip7170a

Happy Programming! =)
Posted by Nils-Holger at 9:52 AM with 437 comments.

Saturday, February 16, 2013

Tip 7.16: You can press F9 to set a breakpoint on the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



The command Debug.ToggleBreakpoint sets (or deletes) the breakpoint on the current line, in case you don't want to take your hands off the keyboard.

vstip7160

Happy Programming! =)
Posted by Nils-Holger at 2:54 PM with 440 comments.

Friday, February 15, 2013

Tip 7.15: You can set a breakpoint by clicking the indicator margin

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog

Sara Aside

She's very big into starting off with the basics, just in case someone reading this didn't know about this tip.
You can set a breakpoint on any applicable line by clicking the indicator margin, as illustrated here.

vstip7150

Clicking here inserts the breakpoint, as shown next.

vstip7150a

Happy Programming!
Posted by Nils-Holger at 11:34 AM with 756 comments.

Thursday, February 14, 2013

Tip 7.14: You can use tracepoints to log PrintF() or Console.WriteLine() info without editing your code

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Right-click in the editor wherever you want to insert a tracepoint, select Breakpoint, and then select Insert Tracepoint.

vstip7140

This brings up the tracepoint dialog box, which gives you some helpful default settings. But for this example, the really helpful default is in the descriptive text for logging the contents of a variable.

vstip7140a

You'll notice that the editor shows a diamond instead of a circle.

vstip7140b

And the tracepoints are logged in the Output window's Debug pane.

vstip7140c

Happy Programming! =)
Posted by Nils-Holger at 1:45 PM with 441 comments.