The opinions expressed in these materials are my own and are not necessarily those of Microsoft.
Copyright © Microsoft Corporation. All rights reserved. Unless otherwise indicated, all source code provided is licensed under the Microsoft Public License (Ms-PL).
NOTE: This is an older feature. I’ve updated the information for VS2013.
The Breakpoints Window (CTRL+ALT+B) is an awesome tool. We use it frequently to aid us in our debugging efforts. Let’s take a look at some of the things you can do when working in this window.
Getting rid of breakpoints is a common task. There are two main ways you can remove breakpoints using the Breakpoints Window.
This one is pretty simple. Select one or more breakpoints and click on the Delete The Selected Breakpoints button:
It will remove the selected breakpoint entries and you are good to go:
In my last post I showed you how to do a search with labels (or any column for that matter) and it turns out you can delete the results of a search. For example, if you have a set of breakpoints:
And have filtered them with search criteria:
You can delete the results of the search by using the Delete All Breakpoints Matching The Current Search Criteria button:
(Note: Using this button without having a search filter will delete all your breakpoints so use this button with caution)
Which will delete all visible breakpoints:
This does not impact breakpoints that were not part of the search result. You can verify this by clearing the search criteria:
In addition to deleting breakpoints you can export breakpoints based on the current search criteria (or all breakpoints if no search is set):
The exported breakpoints are saved to an XML file and can be imported later on:
Special Note: At the time of this writing my breakpoint export wasn’t working. This may be a bug in the VS2013 Preview or just my installation.
Make sure to take full advantage of the Breakpoints Window during your debugging efforts. Take some time to work with these techniques to save you time and frustration.
The Breakpoints Window has supported adding labels since VS2010, however most people aren’t aware of this feature. But how does this help you? Well, first, you can 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. Let’s see how to make this happen.
Go into any code base and create several breakpoints (F9) then open the Breakpoints Window (CTRL+ALT+B):
Notice the Labels column? It goes largely ignored unless someone points it out. To add a label to a single breakpoint just Right-Click it and choose Edit Labels:
Alternatively, you can select multiple breakpoints and do the same thing to create labels in bulk:
For this demo, select about half (or a little more) of you breakpoints and edit their labels. This will bring up the Edit Breakpoint Labels dialog:
Put in a label of “cart” to indicate these breakpoints are associated with our shopping cart and click add:
It turns out that these particular breakpoints are also associated with adding items to the cart so let’s put in another label of add item:
The point here being that you can add multiple labels to breakpoints. Click the OK button and notice the result:
Let’s assume the rest of the breakpoints deal with deleting items from the cart. Select them and edit the labels:
Since “cart” is already in our list of breakpoint labels we can simply select it:
Now we just add “delete item” to the list and we are all set:
Click OK and verify all the breakpoints have labels:
Now that we have set the labels we can sort by the labels column entries by click on the column header:
Everything looks in order but let’s make a change. Edit one of the “add item” entries to read “modify item”:
Take a look at your list again and notice how they are sorted:
The labels are sorted alphabetically from left-to-right so pay attention to your label names. In this example we have a potential issue since the word “cart” is keeping the sort from happening the way we want it. Fortunately for me, since they are all related to the cart, I can safely turn off the “cart” word and still have contextual meaning for my labels:
Now that we have good labels set up we can do more advanced activities. We can search by any column but searching by labels we designate is particularly powerful. For demo purposes I’m going to make a point about searching you need to pay attention to. We want to find all the “add item” breakpoints. Click in the search box and type the letter “a” and press Enter:
As you can see it did not filter as expected. This is because the In Column value is set to All Visible. Since the letter “a” appears somewhere in every breakpoint we need to tell search to only pay attention to the labels column:
This results in getting the desired outcome:
To clear the search criteria just click the Reset Search Criteria button:
All the breakpoints will come back:
You can do many great things with this feature so experiment and see if it is valuable for you. There are a lot of great things you can do with breakpoints and this is only the tip of the iceberg. I’ll discuss other features in a future article.
This is one change to Visual Studio that I’m not a fan of and I still continue to see a ton of posts on this change so thought I would share here as well.
I always try to give credit where credit is due and I believe the earliest mention of this fix is by Richard Banks in his post 6\1\2012 here: http://www.richard-banks.org/2012/06/how-to-prevent-visual-studio-2012-all.html
Okay so you really, really don’t like the Uppercase menu in VS2012 because you feel like it is shouting at you:
You would rather go back to mixed case for your menu:
Not a problem! Below are ways you can fix this feature in VS2013.
WARNING: Making changes to the registry can cause unexpected results so do any changes at your own risk!
NOTE: Watch your spelling if you are typing this manually.
If you like to “simplify” this a bit you can use PowerShell to run a nice script to make this happen. However, if you haven’t used PowerShell before this may not be faster for you.
Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\12.0\General -Name
SuppressUppercaseConversion -Type DWord -Value 1
Restart Visual Studio and you are good to go.
This one is a little known feature you can take advantage of when working with your code. Assuming you have some unformatted code:
You can format the entire document by going to Edit -> Advanced -> Format Document (CTRL+K, CTRL+D) to get this:
You can also do this with just a selection of code:
Go to Edit -> Advanced -> Format Selection (CTRL+K, CTRL+F) to get this:
I won’t go deep into it here but it’s important to remember that the automated formatting follows the default rules you can easily change by going to Tools | Options | Text Editor | [Language] | Formatting in most cases. For example, to change the HTML rules go to Tools | Options | Text Editor | HTML | Formatting:
In the case of HTML, you can go pretty deep into the formatting options by clicking on the Tag Specific Options button:
Formatting the document or selection is a great way to make your code more readable. Enjoy!
NOTE: This is an older feature I’ve updated the information for VS2013
Ever been writing some code and you want to leave a reminder to yourself to do something on a particular line or area? Did you know about the "to do" comment feature or custom tokens? They seriously rock if you have never used them and, because they go in source code, everyone can have access to the information when you check-in the code!
So here's how TODO comments work:
In VB you just put any comment in that begins with the letters "todo" (case doesn't matter):
In C# and C++, it's pretty much the same thing (again, case doesn't matter):
In C++ you have to explicitly turn this feature on. Go to Tools | Options | Text Editor | C/C++ | View and change Enumerate Comment Tasks to True:
Regardless which language you use the result is an entry in your Task List:
Note: You can Double Click any entry to automatically have the editor go to the respective line in your source.
If you don’t see the entries, make sure you have set the task list to see comments:
We actually have several tokens you can use in addition to TODO. To see all the existing tokens go to Tools | Options | Environment | Task List:
You are welcome to use HACK and UNDONE as well. The MSDN documentation is horrifically bad when it comes to describing these tokens and I don’t agree with the description of use necessarily. Here is what it says:
“Items labeled TODO, HACK, and UNDONE in the Task List window indicate code problems that do not keep the project from compiling, but that do cause run-time errors. You should correct these errors before running the project.”
Also, be aware that the number of entries that appear in the Task List changes depending on the type of project you are working on. With VB and C# projects, the Task List displays all of the comments in the project whether the file is open or not. With C++ projects, the Task List displays only the comments that are found in the files currently opened for edit.
Feel free to create your own tokens for your use. Creating your own tokens is very simple, just pick a name for your token and type it in the Name textbox:
Note: UnresolvedMergeConflict looks like an error but isn’t it is an actual token that will make a high priority item in the Task List.
Next choose a priority level:
Then click the Add button to make it an active token:
You will see it in your list:
Now you can use the token in your comments:
Be aware that any tokens you create ARE NOT SHARED with other developers so you may want to come up with a standard set of tokens for everyone to use if you intend to leverage this feature company-wide then export them (http://blogs.msdn.com/b/zainnab/archive/2010/07/14/exporting-your-environment-settings-vstipenv0021.aspx) and have folks import them (http://blogs.msdn.com/b/zainnab/archive/2010/07/15/importing-or-changing-your-environment-settings-vstipenv0022.aspx).
Tokens are a pretty nice feature to keep track of places in your code you need to revisit. I don’t suggest them over, say, tasks in Team Foundation Server but they are a great short-term reminder for things that need to get attention. If you decide you would like to create Task List items programmatically you can do that as well. Here is a link to some guidance to get you started:
The original Code Map was introduced in the product with Visual Studio 2012 Update 1. You need to read my original post before moving on:
My assessment at the time was that it was a good feature but had poor performance and didn’t really add much value relative to Dependency Graphs. With debugger integration however Code Maps have definitely come into their own and the performance is very good.
Note: Code Map Debugger Integration is a feature in the Ultimate edition of Visual Studio.
Assuming you have a handle on Code Maps now let’s see how the debugger integration works. First, I’ll take the TailSpin Toys sample code and set a breakpoint within the code base (ShoppingCart.cs, line 61):
I’ll press F5 and add an item to my cart to trigger the debugger:
Ordinarily, we would step though the code and hope we remember how we got to a particular place. Those days are gone! Now we can turn on the Code Map feature while debugging:
You can also find this on the Menu Bar at Debug | Show Call Stack on Code Map:
If we take a closer look at the current map, we can see that it shows how we arrived at the current call (the squares above the last AddItem call) and our current location (yellow arrow). Although the current location indicator is partially covering it, you can also see the breakpoint indicator:
Stepping through the code we see the map keeps updating so we don’t have to keep the path in our heads:
The Code Map will continue to update for our debugging session showing where we have been and where we currently are in the call stack:
The graphs can get quite large:
For this reason it’s important to use the map tools at your disposal. The context menu items when you Right Click any node are a great example of common tools:
You can Double Click any node to view the code from that location in the stack. A green arrow will indicate your current position:
If you happen to choose a node that isn’t part of the current active call stack then you will get a slightly different indicator:
When you stop debugging the Code Map will be preserved so you can save it if desired and keep a map of the code base you just went through. I think this is an exceptional addition to the debugging experience!
Just came across these the other day and wanted to share below is the information verbatim from http://msdn.microsoft.com/en-us/library/vstudio/ee889983(v=vs.120).aspx
Welcome to the technical articles for Application Lifecycle Management! These technical articles provide additional resources for you to use when supporting your development efforts with Team Foundation Server. Some provide in-depth technical information about unique scenarios that involve Visual Studio Application Lifecycle Management. Others provide insights into development processes and philosophies from industry experts that you might want to consider when developing your software or working as a team on a software project. These articles represent the viewpoints, opinions, and experience of their individual authors.
Agile Principles and Values, by Jeff Sutherland. Jeff Sutherland provides an overview of the Agile principles as defined in the Manifesto for Agile Software Development.
Ten Year Agile Retrospective: How We Can Improve in the Next Ten Years by Jeff Sutherland. Ten years after the publication of the Agile Manifesto, Jeff Sutherland describes the successes of Agile and pinpoints four key success factors for the next ten years.
Done and Undone by Ken Schwaber and David Starr. Delivering a done increment is critical to being successful with agile software development. Using both real-world and theoretical examples, the authors demonstrate the difference between perception of "done" and the reality of "done," and how that affects the success of a project. Using these examples, the authors go on to demonstrate tools and strategies that can help teams start with a definition of done that makes sense for them, and methods to help teams communicate dependencies, status, and the meaning of "done."
Building and Managing the Product Backlog by Mitch Lacey. A good product backlog is at the heart of any well-functioning agile team. In this article, Mitch Lacey explains the importance of a product backlog, describes what makes a good backlog, and provides some best practices for creating and maintaining your backlog.
Prioritization by Mitch Lacey. In this article, Mitch Lacey discusses three methods that have proven very beneficial for many Agile teams: the Kano Model of Customer Satisfaction, a series of Innovation Games by Luke Hohmann, and Karl Weigers’ Relative Weighting model. He describes how any of these methods can help you move from rough prioritization of your backlog to a precise ordering that satisfactorily weighs risk, importance, and customer satisfaction.
Estimating by Mitch Lacey. Mitch Lacey discusses the difficulty surrounding software project estimation, and provides tips and tricks for using two agile software estimation techniques when teams are estimating projects.
Sprint Planning by Mitch Lacey. Sprint planning does not need to be challenging. In this article, the author provides examples and strategies for keeping sprint planning focused and effective, and detail potential solutions to common problems teams encounter when planning a sprint.
Effective Sprint Retrospectives by David Starr. Going beyond techniques, this article offers ways to maintain and improve the practice and results of Retrospectives.
Distributed Scrum by David Starr. Distributed teams often struggle with consistent, timely, and effective communication. In this article, David Starr explains how Scrum offers a container in which different types of distributed teams can improve and succeed.
Enterprise Agile: Using TFS to support portfolio backlogs across multiple teams by Gregg Boer. Learn how TFS can be configured to support a portfolio of backlogs which provides automatic roll-up and management insight into work across multiple teams.
Lean Software Development by David J. Anderson. David J. Anderson describes Lean Software Development, its history, and how it can be used by software development project teams.
CMMI Principles and Values by David J. Anderson. The concept that an organization can be appraised at a particular maturity level and that this is an indicator of capability to deliver reliable work to the government is a matter of ongoing debate. In this article, David J. Anderson makes a case for Capability Maturity Model Integration (CMMI) and describes how it provides valuable insights for managers, process engineers and all external stakeholders including customers, investors, governance bodies and auditors.
The Lean of Scrum by David Starr. In this article, learn about the inherent Lean qualities of the Scrum framework along with various ways to help Scrum Teams improve using Lean Thinking.
Microsoft Solutions Framework (MSF) Overview . In this article, learn about the Microsoft Solutions Framework (MSF), an adaptable approach for successfully delivering technology solutions faster, with fewer people and less risk, while enabling higher quality results.
Application Analytics: What Every Developer Should Know by Sebastian Holst. In this article, Sebastian Holst discusses the objectives and advantages of application analytics.
Exploratory Software Testing by James Whittaker. In this article, an excerpt from his book Exploratory Software Testing: Tips, tricks, tours and techniques to guide test design, James Whittaker discusses goals, advantages, and approaches to exploratory software testing.
This next feature only applies to C++ and C# just so you know. There are four things I want to talk about: highlighting, moving, selecting, and defining matching braces.
If you have any code with matching braces:
You can put your cursor to the left of any brace and it will highlight the matching one:
If you want to move the cursor from one brace to another simply press CTRL+] (close bracket) to jump, forward or backward, between them:
If you press CTRL+SHIFT+] (close bracket) then it will not only jump to the matching brace but will highlight everything between the braces as well:
Lastly, the definition of “brace” is very loose and applies to square brackets, curly braces, and parentheses:
So feel free to use this feature set with just about any type of brace.
This is another quick but useful feature. Let’s say you have some code:
And you need a line, either, above or below the line your cursor is on. Not a problem! Just press CTRL+ENTER for a line above:
Or CTRL+SHIFT+ENTER for a line below the current line:
I’m back! Vacation was great but now I’m ready to get back into the swing of things. I thought we would get things going again with a look at two features of IntelliSense: Pascal Case and keywords.
This is one of my favorite features! Have you ever been in a situation where you wanted to use IntelliSense to get a method but there are a TON of methods that start with same word and you have to type almost the entire method name:
Let's say you want the SetWindowSize Method but really, really don't want to type it out or even scroll down to get the method. IntelliSense supports Pascal Case. All you have to do is type "SWS":
This is true in a number of areas within Visual Studio now so feel free to try this in other areas (i.e. the search dialog in Solution Explorer).
To show you the new feature, let’s take a look, way back, at VS2008 IntelliSense. Notice when I type Console.Key what happens:
IntelliSense used to be this huge alphabetical list and would just show you whatever begins with the keyword you were typing at the time. In this example, it takes me to the “key” area in the list. Notice that it then continues into the “L” and “M” and so forth. That’s great but what if I don’t know what I am looking for but I know that it has the word “key” somewhere in it? Well, I can go search in the Object Browser, of course or I can use keyword feature that was introduced with IntelliSense for VS2010. Watch what happens when I do the same thing in the VS2013 editor:
It now shows only those items that have the word “key” in them AND doesn’t care where the word is in the name of the member! So not only do it get items that begin with “Key” but I get ANYTHING that has the word “key” in it.
There are some great hidden gems in the editor and these are just a couple of them. Stay tuned for many more goodies to come.