Feeds:
Posts
Comments

Archive for July, 2010

Howdy people,

This time we’re going to have a look at another small (but effective) improvement in Visual Studio 2010: The breakpoints got some new achievements, namely:

  1. Labeling breakpoints
  2. Searching for breakpoints (Breakpoints Window)
  3. Specifying hit counters
  4. Import/Export breakpoints

Labeling is easy-to-use and newly available in Visual Studio 2010 (not in the Express Editions). Later on, we can also use these labels for searching.

After setting up a small console application (containing only the default-generated Program class), let’s declare an array of type Int32 and name it values. A simple foreach loop should iterate over the array. We’ll also place a breakpoint at the beginning of the loop. That’s enough for showing the new achievements. Figure 1 shows it:

 

image

Figure 1: After setting the breakpoint

 

After we’ve set the breakpoint, we can deliberately access the labels by right-clicking on the breakpoint and choosing EDIT LABELS from the context menu, as seen in Figure 2.

 

image

Figure 2: Accessing labels after a right click on the breakpoint

A window will open, allowing to define a new breakpoint label or to assign an existing one. In our case, I have already defined a label “NumberLoop”, which we’re gonna reuse. A check near the label in the list does the assignment, and confirming the dialog window sets the assignment. From now on, our breakpoint is called “NumberLoop”.

image

Figure 3: Label definition/assignment

We can verify the assignment immediately by bringing up the Breakpoints Window, which is located under Debug-Windows-Breakpoints Window (CTRL+D, B).

image

Figure 4: The breakpoints window, showing our breakpoint w/ label

The breakpoints window basically shows all breakpoints along with their name (i.e. filename and position in the code, as well w/ label, conditions and hit count). Additional columns can be defined by using the menu entry “Columns”, as seen in Figure 4. Defining another label in the code, 2 lines below, will result in Figure 5. Let’s try to enter “Number” as a search term in the menu of the breakpoints window.

image

Figure 5: 2 Breakpoints, before search

image

Figure 6:  After search – our breakpoint was found

The advantage is clear: When having lots and lots of breakpoints, it will be easy to give them meaningful names, so they can be found easier afterwards.

Moreover, by right-clicking on the desired breakpoint, a context menu will open, containing the entry “Go To Source Code” (“Go To Disassembly”, respectively), allowing you to navigate directly to the position in the code, where the breakpoint is located.

The hit counters where already available in VS2008, and haven’t really changed, but for the sake of completeness they shall be named here as well. Right-clicking on a breakpoint allows you to define a hit counter for a specific breakpoint.

 

image

Figure 7: Defining hit counters for breakpoints

It means, the breakpoint will only be hit when a certain hit counter is reached. If you only want to see how many times a break point actually is passed, it is recommended to set the hit count to a very high value (that will never actually be reached). This way you can evaluate the hit counter afterwards and check for the actual value.

image

Figure 8: The hit count definition window

Breakpoints with conditions and/or hit counts are displayed as image. Disabled breakpoints will invert the colours.

The last new feature is the import / export of breakpoints. It is also available in the breakpoints window. The 2 buttons image are for exporting and importing, respectively, and will produce/accept an XML file containing not only the breakpoints, but also applying the search criteria you defined in the breakpoints window. This way it’s easy to reuse even your breakpoints. In a possible scenario you want to pass your breakpoints to another developer, who is working on the same project, this seems quite a handy feature.

Enjoy finding and exterminating bugs!

Best regards,

Martin

Read Full Post »

Hello all,

Following scenario: Let’s assume we have a MOSS 2007 site containing some pages. Furthermore, let’s assume we want to create a site template out of this exisiting site. In fact, it is possible to save it, but the option is a bit hidden.

Assuming, we have the following site:

http://server:port/mysite/

And we want to save this site as a template (.stp) for reuse, then, unfortunately, there is no link or option in the “Site Settings” for fulfilling this need. But we can do the following:

Append “_layouts/savetmpl.aspx” to the URL of our site, and voilà: The Save template page will open, giving us the opportunity to save the current site as a template.  In the above case, this means the URL would have to look like:

http://server:port/mysite/_layouts/savetmpl.aspx

Which brings us to the following mask:

image

Figure 1: The “Save Site as Template” mask

After that, you can comfortably access the newly created site template under

Site Settings –> Modify All Site Settings –> (Column: Galleries:) Site Templates.

If the latter menu point doesn’t show up, be sure you are in the top level site settings (otherwise go there using “Go to top level site settings”)

Best regards,

Martin

Read Full Post »

Howdy folks,

The Visual Studio Team recently released a set of installable extensions that help to improve the productivity while working with the new Visual Studio 2010. This set of extensions is called Visual Studio Productivity Power Tools, and it really keeps its promises.

1. Editor Improvements

There is a set of features that directly integrate into the Code Editor. At the first glance after installing the VSPPT you can see the current editing line is entirely highlighted (see figure 1) This is good for immediately recognizing which line we are working in. Personally, I think it can be of great use, since it often happens to me not to immediately see where I was editing after e.g. an ALT+TAB switch between windows.

 

image

Figure 1: Highlighting of the current line (current caret position)

  • Automatic Brace Closing (ABC)
    This works with all types of braces, as well as with quotes.
  • Triple-Click to select entire line
  • Go-to-Definition:
    Simply by holding the CTRL-Button and clicking on the variable/function/class etc. Just like in Word when you are following links!
  • Automatic Statement Completion: SHIFT+ENTER will insert a semicolon and end the current editing line
  • Move line up/down: Press ALT+UP/DOWN to swap the current editing line with the line above or below, respectively.

2. The Quick Access Tool Window

A very handy tool when it comes to remembering menu item’s locations. Do you waste time searching through the menu for command or tool window you would like to access? This problem’s solved now. Simply type CTRL+3 in order to bring up the QA Tool Window. As you type, the window will show you:

  • Menu commands
  • VS options
  • Project templates

(a personal remark: it would have been nice if the team would have also included the option to search for item templates over the QA).

You can cycle through the search results by pressing CTRL+3 more often. Figure 2 shows the Quick Access Tool Window.

image

Figure 2: The Quick Access Tool Window listing results by category.

3. Searchable “Add Reference” Dialog

A great improvement – it’ll gonna save us a lot of time looking for assemblies we need.

image

Figure 3: The new “Add Reference” dialog

4. Assignment Alignment (oh, what a rhyme!)

Very nice feature for keeping the overview when having a lot of assignments – in such a case it might be hard to read the assignment value of a variable that has been assigned to somewhere in the middle of the block.

image

Figure 4: Unaligned assignments

Hitting CTRL+ALT+] (English keyboard layout, with the German one it didn’t work but only produced a square bracket). It’ll transform the code from Figure 4 into something that looks like the code in Figure 5:

image

Figure 5: Aligned assignments.

There are many more extensions that come with the Visual Studio Productivity Power Tools, and I pointed out only the ones who caught my eye at the first glance. However, for a full feature list, you should go to Productivity Power Tools Page.

Below you can find a download link for getting the Microsoft Productivity Power Tools:

http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef/file/29666/2/ProPowerTools.vsix

 

5. Only Get What You Need

By the way, in case you shouldn’t want to use each feature of the Power Tools, you can simply enable/disable them one by one using the Tools-Options-Productivity Power Tools dialog window, as shown in Figure 6:

image

Figure 6: The PPT options dialog.

Note: A restart of VS 2010 is needed for the changes to take effect.

Conclusion

These extensions are very handy when it comes to speeding up development and saving time for trivial tasks like closing braces, ending statements, searching for templates and references etc. I think I’m going to try them for the daily productive use in order to be able to confront the coding with/without the VSPPT. But if my first impression persists, then it’s gonna be a great time-saver and productivity-improver.

Best regards and stay tuned!

Martin

Read Full Post »