July 20, 2015

Visual Studio 2015 RTM - My Favorite Features

It seems like just yesterday that we were anxiously awaiting the release of Visual Studio 2013, now we are on the brink of yet another round of amazing .NET changes.  The evolution of the development tools as well as the underlying languages and platform can be daunting to keep track of.  Having been using Visual Studio 2015 for a while under the various Microsoft Release Candidate releases I have had a good amount of time to play with the IDE as well as the new language features.  So I thought what better way to help celebrate the RTM (Release to Manufacturing) of VS 2015 than to share my favorite features and improvements.  This is only a mere subset of the features that I enjoy.  i will have future blog postings going into more detail on a number of these!

Visual Studio IDE Improvements

Although there are a number of improvements as it relates to the languages, I have to start with the things that impress me with the IDE!

Compile Time Performance

Visual Studio 2015 contains the new compiler, formerly known as Roslyn. The changes that come to the IDE due to the introduction of the new compiler are exhaustive and I will showcase a few of them a bit later as well. However, one key improvement is what I can only describe as a more efficient build process by the compiler. I don't necessarily know all of the details on why, but every project that I work with opens faster and compiles faster now!

Real-Time Compile for C#

Of all of the IDE changes for VS 2015 this is one of the ones that has actually been the hardest to get used to, although one of the nicest. For those that have had experience with VB and I'm sure other languages that have a real-time compile, you get better feedback about errors sooner. With VS 2015 we have real-time compile for C#. This means that as we write new code, Visual Studio is compiling and validating our code behind the scenes. This results in more detailed error messages getting to you sooner. A great productivity gain.

Out of the box Xamarin Support

Microsoft is really promoting the development of cross-platform applications using the .NET languages. As such Xamarin tools and all needed supplemental development items (including the Java SDK for Android) are installable options when you work with VS 2015. You still need to have your own license for the individual Xamarin products though. The key for me is that it is much easier to get started with Xamarin this way!

Stored Window Layouts

Every person is quite particular with their Visual Studio layout, for example I cannot stand the light theme! In VS 2013 we started to get more control over our interface with dockable panels, and support for multi-monitor. In VS 2015 things are even better where Visual Studio can support multiple window layouts. Get Visual Studio setup the way you want when working at the office and save it as your desktop layout. Disconnect from the office and get things ready for mobile use with the laptop monitor only and save that. Now you can seamlessly switch between layouts. I have been experimenting with different options beyond this for when I switch from WPF to ASP.NET projects as well.

Improved Debugger Experiences

I spend a lot of my time day-to-day working on application performance and often debugging code from other places trying to understand how it works and what might have gone wrong. Visual Studio 2015 includes a number of improvements in the debugger experience. There are two items in this area that I am especially excited about. You now have the ability to filter the error list display and with the real-time compilation as I noted above it makes it easy for developers to get a good glimpse of what is going on in their applications in real time.

VS 2015 Debugger DiagnosticsAlong the performance front the diagnostics tools have received an amazing overhaul. Perf-Tips being the major feature name behind all of this. Within Visual Studio. you now have the ability to track execution time of methods as well as the execution time between two breakpoints. Historically it would be common practice to declare a new Stopwatch and then stop it at various places to get timings. All of that goes away. It is important to note that these features are debugger features and they work not only for those projects that are working on .NET 4.6 but also for any other prior compile target!.

TODO: and HACK: Comment Support Changes

Although I'm listing this as the last item in my IDE highlights, this is the one that I'm most excited about! For years within C# code it has been possible to use //TODO: comments to have items appear in the User Task List view within Visual Studio. Working with a distributed team TODO and HACK comments worked as great reminders to get attention of others, or even to simply remember something for a next round refactoring. However, prior to Visual Studio 2015 there was no support for TODO: and HACK: within the HTML editor for our ASP.NET Views etc. With Visual Studio 2015 these items will appear in the listing just like your C# code. This even works with static HTML & JS files. In my testing of this feature though

C#/VB Improvements

With a number of improvements for Visual Studio there was no lack of improvement for us on the C# side of things. The full release notes include all C# additions. A few of my favorites are highlighted below.


We have all been there, as an application grows refactoring is needed and the names of objects will change. It is inevitable that at some point we have a hard-coded reference to the name of the item that we just refactored in a manner that doesn't get caught by refactoring tools. The best example of this is for situations in MVVM with WPF where a call to NotifyChanged() is needed after updating a property. Introduce the new nameof expression for C#. It is used to obtain the unqualified name of a variable, type or member. This can be used in things such as notify property changed, error reporting, MVC Controller Links, etc. A few examples are below.

//Null Parameter Exception Example
public static void DoSomething(string input)
    if (string.IsNullOrEmpty(input))
        throw new ArgumentException(nameof(input));

//Dependency Property notifications
public string MyProperty
    get { return _myProperty; }
        if (value == MyProperty)
        _myProperty = value;

//Debugger help
[DebuggerDisplay("={" + nameof(DoSomethingImportant) + "()}")]
class MyDemoClass
    string DoSomethingImportant()
        return "test";

These are just a few examples of ways that nameof can make your code easier to maintain. Using these methods refactoring tools will assist in renaming operations should something change. For those using ASP.NET MVC this is a great thing for navigational links using NameOf to bind links to controller actions!

Null-Conditional Operators

A lot of time is spent writing code for null-reference checking and operating around the situations where it could become problematic. A new operator was added ?. in C# that can be used to perform a null check prior to calling a method. For example myValue?.Length will return a null if myValue is null, rather than throwing a null reference exception. Another great example of use is when invoking a event, a test is done often similar to if(MyEventName != null) then you invoke. This all changes to a single 1 line statement. MyEventName?.Invoke(e); Much more readable and getting developers back to the key issues faster.

Auto Property Enhancements

Auto Implemented properties are an amazing time-saver when it comes to writing code. However, the inability to set default values resulted in more code needing to be written. With Visual Studio 2015 you may now set an initial value for an auto-implemented property the same way that a field would be initialized. Additionally new support for get only auto-properties are listed as a new feature.

Go for it!

I'm very excited for this new release of Visual Studio. Given the backwards compatibility I'm upgrading and enjoying all of the new features that I can and working to move more projects forwards to be able to leverage all of the other stuff. It is important to note that I've only scratched the surface. I haven't discussed anything about Cross-Platform development etc. I will work to blog more about new features as time permits! But feel free to share your favorites below!

tags: ASP.NET, Visual Studio, ASP.NET MVC, .NET 4.6
comments powered by Disqus

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Content Copyright

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.