(Print this page)

What’s new in Visual Studio 2015
Published date: Sunday, December 14, 2014
On: Moer and Éric Moreau's web site

By now, you are surely aware that the new year will bring (at a date yet to be announced) a new version of Visual Studio (named Visual Studio 2015) and a new version of the framework (named .Net Framework 4.6 even if the preview shows 4.5.3). For now, we can play with the Preview version publicly available.

Visual Basic will be at version 14 (version 13 has been skipped!) while C# will be at version 6.0.

This month’s article isn’t much about code. I will list my top 5 new features and enhancements I personally prefer.

What you need

If you are like me and want to start playing with the bits right now, you can download the preview version from http://www.microsoft.com/en-us/download/details.aspx?id=44934. But be warned that you should not install it on a production computer. You also cannot start deploying applications built with it (no go-live license yet).

List of language features is available from https://roslyn.codeplex.com/wikipage?title=Language%20Feature%20Status.

Number 5: Open Source Framework

For a couple of years now, Microsoft started to offer some portion of the .Net Framework to the open source community. Probably the 2 more known parts were Entity Framework and ASP.Net.

Going forward, more and more of the .Net Framework should be made available to the community.

Everybody can get involved or if you want to learn more, visit the .Net Foundation.

Number 4: Roslyn and Analyzers

Many enhancements are possible because of Roslyn. Roslyn is the code name of the “.Net Compiler Platform”. It is a project on which many Microsoft employees worked on for the last 5 years. They have simply rebuilt the compiler from the ground up. You can now see the compiler more as a service.

This new compiler opens a new world of opportunities. Previously, tools like Resharper had to build their own version of the compiler to be able to analyze the code to provide tips and being able to offer features like refactoring. With Roslyn, the compiler offers the full syntax tree and everybody will be able to easily offer tools like visual analyzers and code refactoring tool. (I know that Resharper is much more than this 2 features but they are probably the most used).

In the next few months, we should see a lot of “analyzers” to help developers write better code long time before compiling. Most of these analyzers will be made available through Nuget.

A great short video on Analyzers is available at http://channel9.msdn.com/Events/Visual-Studio/Connect-event-2014/714.

Number 3: Support of Lambda expressions in the debugger windows

Most of us are now using lambda expressions as they are really helpful. Just think about LINQ queries. One thing that annoyed everybody was the fact the debuggers were not able to deal with them correctly.

In Visual Studio 2015, all the debugger Windows (Watch, Locals, Auto, Immediate, and so on) will be able to evaluate lambda expressions.

The lambda expression that you are writing in one of the debugger windows will need to be in the same language that is currently being debugged.

Figure 1: Lambda expression in the Watch window (VB)

Figure 2: Lambda expression in the Watch window (C#)

One of the cool thing is that for some expressions, you won’t even need to be running/debugging an application. As you can see in figure 3, the expression written in the Immediate Window was written and executed while the IDE was in design mode. This will let you test some expressions without having to run an application.

Figure 3: Immediate window while in design mode

Number 2: String Interpolation (the $ operator)

Everybody knows the method String.Format that we use with numeric placeholders to replace with real values passed as a param array. It works ok but sometimes the numeric placeholders (ie {0}) are cumbersome.

In VS2015, you will be able to use the name of properties and functions (the same name you are using in the param array) right into the placeholders as shown in figure 4.

Figure 4: String interpolation

If you would like more details about this feature, visit https://roslyn.codeplex.com/discussions/570292.

This feature has not been implemented in the Preview version of VB. Also note that the syntax implemented for C# will change between the preview and the final release (as shown in figure 4).

Number 1: The Null propagating operator (?.)

This operator is also known as the Elvis operator or as the conditional-access expression.

When dealing with classes instances, we need to add a lot of lines to our code just to ensure we don’t have null instances that would make our code fail. This leads to many if statements. C# also needs to pad before raising events.

If these if statements are annoying you, you will be happy to discover the new Elvis operator (?.) as shown in Figure 5.

Figure 5: The Elvis operator

Notice that this snippet is in VB but C# will have the exact same implantation. At runtime, the left part of expression (before the ?.) will be evaluated and only if it returns something that is not Nothing (or null in C#) the right part will be evaluated.

If you would like more details about this feature, visit https://roslyn.codeplex.com/discussions/540883.

Conclusion

As you can see, Visual Studio and the .Net Framework might be mature but it is far from being dead. Microsoft continues to improve version after version.

In appearance, this release does not include killer features like the Lambdas or LINQ a couple of version back but Roslyn placed the platform on a new solid ground to build new exciting features.

To get yourself ready, you can downloads the preview version and start playing with it. If you don’t have a spare machine (or you don’t want to run it from a virtual machine), you can at least check the recordings made at the Microsoft Connect() developer conference held November 12 & 13. You could also use an Azure account (even a trial account) to run a VM in the clouds! Details on how to set it up are available from http://www.c-sharpcorner.com/UploadFile/9c2805/setup-visual-studio-2015-preview-quickly-via-azure/.


(Print this page)