Pages

Wednesday, January 5, 2011

Visual Studio 2010 IDE Features

Views

Introduction

VSTS 2010 added lot of new IDE [Integrated Development Environment] features along with the other language or SDLC features. This IDE feature includes features to help in fast development and efficient debugging tools.  This article will help you in understanding few of the IDE features introduced in VSTS 2010.

Navigate To


The new Navigate To Window allows a fast search mechanism. For launching the Navigate To window, press the key combination ctrl and comma (,) in VSTS 2010 IDE. Navigate To window will allow different kinds of search and navigate to a particular item or class. For navigating to a particular item in the result, double click on the same.

Incremental Search

Navigate To allow the Incremental search, where it search the solution and display the results in an incremental form. In the following example, we are start typing the word in search box; results are filtered on the fly and refreshed.

Note that, by entering shop, we are getting 27 items under result.
When we enter the search string as shoppingcart, the result is modified and now only 16 items are available under results.

Multiple words

Navigate To allow searching using multiple words separated by space. In the following case, Navigate To will search items containing both shoppingcart and effect.

Pascal Case Searching

All the built-in methods and classes follow the Pascal case as naming convention. Pascal Case means, each word in the name will start with capital letter. Navigate To allow searching the items using Pascal case or using the first letters of the words in an item.

In following case, we are searching SIC, which returns the items containing SelectedIndexChanged, ShipperIDChanged, ShipperIDChanging, etc.

View Call Hierarchy


View Call Hierarchy feature will help you to view the call hierarchy of a method. Right click on the method; select View call Hierarchy from the context Menu.
 

This will open the Call Hierarchy Window with Call To Method and Call From Method details. We can drill down to any level using the tree available under method name. Also, we can see the method or property utilization details in the details section [Call Sites] on the right side.

Debugger Improvements


VSTS 2010 added lot of improvements in debugger areas. This includes the Intellitrace, one of the prime features of VSTS 2010, and Pinned DataTips.

Pinned DataTips

Using Pinned data tips, we can Pin the data to the solution itself.  When you debug the solution, pin the variables along with the data and also we can specify few comments along with the data tips.

Pinned DataTips can be added by hovering over the variable and expanding the plus sign near to the variable and select the Pin sign on the right side.
We can re-arrange or drag the Data tips to any location.
Also, this can be added by right clicking the variable and selecting the Pin To Source option.


After completing the debug, the Pinned data will be notated by a Pin on the left margin.


Once hovers the mouse over the Pin, it shows the value from last debugging session.

Pinned tips will be available for the next debug time and also after completion of the debug session too. Even if, you close the solution and re-open it, the Pinned data tips will be available. We have the option to export the Pinned Data Tips to XML file and import the same under Debug Menu.

Breakpoint Labels

Breakpoint labels allow us to group the breakpoint and do some group operation on it. This will be helpful for debugging a complex solution. Instead of adding breakpoints for each debugging session, we can add the breakpoints and export the same for future debugging.

Under Debug-> Windows, we have the Breakpoint Window, which display all active breakpoints.
  
Select required Breakpoints, right click and select Edit Label to label the breakpoints. We can enable, disable or delete the breakpoints using the Breakpoint window. Also, we can search the list of breakpoints using the label.

Export and Import features are available for exporting and importing the defined breakpoints.

IntelliTrace


IntelliTrace is one of the major feature available as part of the VSTS 2010. Full functionality of this feature will be explained in a separate document. IntelliTrace will help us in better debugging experience. This will allows us to go back to a point in the debugging tree, and see the call stack and Local variables associated with that particular point in debugging time. We can set the events or call information, which we need to collect at debugging time. This can be configured under Tools-> Options. As the Intellitrace is having some hit in performance areas, only minimum features or counters are enabled by default. This feature is called as Historic Debugging initially.
           

 

Javascript IntelliSense


VSTS 2010 added lot of improvements in JaveScript Intellisense areas. Few of the improvements are basic type inference and Intellisense with Browser objects.

Basic Type Inference

The type of the variable is inferred from its assigned value. Intellisense will display the methods or properties of the variable according to the type of the last value assigned to it.

Here, testVar is the variable assigned with a string value. The Intellisense displayed for the variable is all string operations like concat, charAt, etc.
 

Now, we are assigning a numeric value to the same variable testVar. After that, check the Intellisense displayed for the variable. Now it displays the operations associated with numeric variable like toString, toFixed, etc.


Intellisense when using Browser objects


When you add browser variable to any browser object, it automatically identifies the same as variable. In the following example, we are adding a global variable check using the browser object window. Eventhough check is passed as an argument, it identifies check as a variable.

In the following example, the variable names are created dynamically; still the Intellisense identifies it as variables and display on the code editor.

HTML & Javascript Code Snippets

VSTS 2010 added lot of code snippets for HTML and Javascript, which help in faster development.

If you want to add the ListView, type
Move to the listview and press the Tab two times. This will insert the following code snippet
<asp:ListView runat="server">
            <ItemTemplate>
            ItemTemplate>
        asp:ListView>

Same we can insert any HTML or Javascript controls or code snippets using the Built-in code snippets.

Highlighted References


When hover the mouse over an identifier, it highlights the references of the identifier in the class. This will help in identifying where all this particular identifier is used.

Intellisense


VSTS 2010 improves the Intellisense. If we are creating one application using VSTS 2008 and target framework as .Net framework 2.0, still the intellisense displayed in the IDE will be for .Net framework 3.5 only. The developer should understand, whether a particular features is available in 2.0 and choose accordingly. This got changed in VSTS 2010. If the target framework is 2.0, it displays only those methods and properties supported by 2.0.

VSTS 2010 Intellisense uses different search mechanisms to display the Intellisense associated with an identifier.

Type Search

When you specify an identifier, it search all types contains the particular identifier. In following example, we specified as List, and the Intellisense displayed all items containing List like LinkedList, ListBox, etc.

 

Keyword Search

When you apply the IntelliSense over an identifier, it searches the associated Methods and Properties containing the specified Keyword or not. In following example, even though there is no property or Mtehod starting with Paging is available for GridView, it displays the options containing the word Paging.
 

Pascal Case Search

Pascal Case is used for denoting the identifiers in VSTS 2010. This will search the letters as the first letter in the words of the Identifier name.  In following example, PIC is mapped with PageIndexChanged and PageIndexChanging.
 

Generate From Usage


Generate from usage is another feature, where we are generating code from its usage.

For example, in the following example we are using a variable iterationCounter, which is not defined in the class. Hover the mouse over the identifier and select the small drop down icon appeared. This will display the options like whether you want to generate the iterationCounter as property or field.
Once you select the first option, Generate property stub, it will generate the following code snippet,
public int iterationCounter { get; set; }

Multi-Monitor


VSTS 2010 allows us to arrange the windows in and out of the VSTS IDE. This will store the position information even for cross sessions. Once you close the solution and re-open it again, the windows will be in the same place.

Conclusion


Visual Studio 2010 released with lot of new features in various areas. This article is describing few of the IDE features. IDE features are giving better debugging experience along with better productivity. Debugging features like IntelliTrace and Pinned DataTips help in fast debugging. Code Snippets and IntelliSense helps the developers to achieve more productivity.

0 comments:

Post a Comment

 

Web Design Company karimnagar, Web Designing warangal, Logo Design Company nizamabad, Indian Website Design Company, maddysoft.co.in