Microsoft.NET

……………………………………………….Expertise in .NET Technologies

What’s New in the Visual Studio 2010?

Posted by Ravi Varma Thumati on February 11, 2015

Better code Intellisense

Visual Studio 2010 has better code intellisense support which make it easier for look for methods and functions. You can now easily search for inline keyword, or even use abbreviation to search for properties or methods.

frame401

frame402

Multi-monitor support

Earlier, all editor and child windows are hosted inside a single parent windows, but with the new IDE you can host every single child windows as separate windows outside of the main windows. You can move these to other monitors which makes it to support multiple monitors.

frame403

Enhanced code Navigations

Visual Studio 2010 has introduces a number of new features to improve the searching and navigational capabilities. The new “Navigate to” features provides you a fast and incremental search of functions, classes, properties etc.

frame404

With its “View call Hierarchy” features can can discover from where a particular method or property is called which helps you to refactor and make you code even better.

frame405

Another features “Highlight Reference” helps of to discover what part of code is using a particular variable.

frame406

Parallel Computing

With Visual Studio 2010, now you can take advantage of multi-core processor by using parallel computing feature. This help you to write code which can execute even faster. Visual Studio also supports parallel debugging for the parallel programming.

Call Hierarchy of Methods

In complicated solutions, a single method may be used from several different places, and attempting to follow how a particular method is being called can be difficult. Call hierarchy attempts to address this problem by visually presenting the flow of method calls to and from the method you are looking at. In other words, you can look at what calls your method and what your method calls in a treeview format.

Obviously, I cannot present a truly complex example, but a simple example should help illustrate the point.

1.   protected void Page_Load(object sender, EventArgs e)2.   {3.      BindDataControls()4.   }5.    6.   private void BindDataControls()7.   {8.      //DataBinding here9.   }10.  11. protected void Button1_Click(object sender, EventArgs e)12. {13.    BindDataControls();14. }

Now, if you wanted to figure out what calls BindDataControls(), you can right-click on it and choose “View Call Hierarchy.”

This gives you a window with a treeview format, as shown below, with nodes that you can expand ad infinitum (or until your machine runs out of memory). You also can right-click on the method names and go to their definition, or you can reset those methods as the root of the Call Hierarchy window if you want to work your way from there and don’t care about other methods anymore Further, you can view call hierarchies from the object browser too, so you needn’t always be viewing the code. This is a helpful visual cue for very complicated projects that we’ve all worked on at some point or another.

frame407

A New Quick Search

A nifty little feature that Microsoft has added is the Quick Search window. This isn’t the same as the Search or Search and Replace window that searches for specific textual strings. It’s different in the sense that it searches across symbols (methods, properties, and class names) across your solution and filters them in the result view for you.

In this example, I typed in ‘but’ and it brought back all symbols that contained ‘but’ regardless of position. You can specify multiple words to search for by separating them with a space.

 frame408

Multi-targeting more accurate

Although VS 2008 supports targeting different frameworks from the same IDE, one problem was that the Toolbox and Intellisense displayed types that were available to the .NET 3.5 Framework whether or not you were working with a .NET 3.5 project. This may have caused problems when you tried to use something, only to realize that it wasn’t actually available to you.

Visual Studio 2010 gets smarter by only displaying items that you can use in the Toolbox and Intellisense (and other relevant areas).

Further, if you change your project to use a framework version that isn’t available on your machine, you will be prompted and can choose to retarget to another version or download the target framework that you wanted.

Parallel Programming and Debugging

Don’t let the name intimidate you. I think Microsoft has done a great job of allowing you to take advantage of multi-processor systems with very easy syntax to enable parallel programming that you can quickly adapt to.

In addition, to make things easier, Visual Studio 2010 comes with a set of visual tools that will help you debug and view simultaneously running threads. This means that you can view the task instances and the call stacks for each task in parallel.

If you’ve been using the Parallel Extensions to the .NET Framework, then most of this will be familiar to you.

A Task.StartNew will kick off your threads for you. If you then hit a breakpoint and view theVisual Studio 2010 Threads window, you can view the state of each thread and where it is currently. This can be seen below—the green indicating the main thread and the yellow indicating all the worker threads spawned.

frame409
There will also be a Multistack window that allows you to peruse the call stacks of all of the threads currently being executed; this is again a helpful visual cue that groups together tasks sharing a stack frame.

Parallel Programming itself becomes a feature of the .NET Framework 4.0 as opposed to it being an extension right now. With Parallel Programming, you get Parallel LINQ (PLINQ) and syntax to make parallelization of algorithms easier. In fact, it’s unbelievably easy.

Say you have a for loop that performed a complicated task:

1.   for (int i= 0; i< 10; i++)2.   {3.      DoSomethingReallyComplicated(i);4.   }

Assuming DoSomethingReallyComplicated does something really complicated (as the name implies), you could parallelize it by using Parallel.For and enclosing the iteration in a lambda expression.

1.   Parallel.For(0, 10, i=> { DoSomethingReallyComplicated(i); });

Similarly, there is Parallel.ForEach<> for foreach loops. You could also use Parallel LINQ to do the same thing. Taking a theoretical, basic LINQ equivalent to the above, you would get this:

1.   from iin Enumerable.Range(0,9)2.      where DoSomethingAndReturnAValue(i)3.      select i

PLINQ would involve a very slight change; just add AsParallel():

1.   from iin Enumerable.Range(0,10).AsParallel()2.      where DoSomethingAndReturnValue(i)3.      select i

You should be able to see the real effects of these changes on multi-core machines under intensive circumstances. Of course, there is much more than I’ve gotten into here, such as parallel profiling views, but that’s beyond the scope here. You could get started now, if you’d like, by downloading the Parallel FX CTP.

XSLT Profiling and Debugging

Everyone hates XSLT. If you don’t hate XSLT, you haven’t used it enough. Part of this attitude towards XSLT stems from the difficulty you face when debugging it—it is a huge unknown and can blow up in your faces when you least expect it.

Visual Studio 2010 will offer an XSLT profiler to help with writing XSLT in the context of profiling and optimization. After writing your XSLT, you can use the “Profile XSLT” option in Visual Studio to supply it with a sample XML file that gets used for the analysis.

I decided to test out a sample XSLT from the Gallery of Stupid XSL and XSLT Tricks page because they would undoubtedly be complicated. The XSLT Profile on Compute square roots using the Babylonian Method produced this:

frame410
Clicking on the ‘offending’ functions then takes you to the function details, among other views on the analysis available to you. Available to you are the paths of execution taken, assembly-level view of the execution, call hierarchy, statistics by function, and function details.

frame411
Also available to you in the menu options is XSLT Debugging. You can launch an XSLT file with sample XML and step through it as you would normal managed code.

frame412

No, your eyes aren’t deceiving you. You can set breakpoints, have locals set, and step through the template functions as you please. This should help alleviate your collective fears of XSLT immensely.

The XSD Designer

While I’m on the subject of XML, VS 2010 also introduces a new XSD Designer.

frame413

It comes with a schema explorer, a visual view of the relationships in different levels of detail, and sample XML generation.

Generate Sequence Diagram

This feature is only available in Visual Studio 2010 Ultimate version. Just right click any method and select “Generate Sequence Diagram” as shown below.
frame414
As shown below it generates sequence diagram.
frame415

 Conclusion

Visual Studio 2010 offers a vast assortment of improvements from its predecessors, from IntelliSense improvements to debugging enhancements. This article highlighted some of the new features ASP.NET developers might be most interested in.

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

 
%d bloggers like this: