Visual Studio 2015 was launched in July 2015. Microsoft has introduced many new features and also has enhanced few of the existing ones. In this article, let us look at my top 7 pick. I have focused primarily on the code editor features along with couple of core Visual Studio ones.
New Emulator for Android
With Visual Studio 2015, you can develop Android mobile apps using native C++, Apache Cordova, or Xamarin. While developing the android apps using the earlier versions of Visual Studio, the pain point was to identify a suitable emulator; now, VS 2015 installs the new Android emulator automatically when you choose to develop an Android mobile application. This emulator supports various Android OS versions and devices.
You also can download the Emulator for Visual Studio from here.
Live Static Code Analysis
The static code analysis results were meant to be post-build events in the earlier IDE versions. Due to this, the developer comes to know about the issues reported by the static code analyzer (like FxCop) only after code compilation. In Visual Studio 2015, you can install any live static code analyzers from the NuGet packages; this warns you about the issues upfront while coding! Figure 1 shows a static code analysis warning displayed on the IDE source code editor.
Figure 1: Static code analysis warning
Note: I have used Microsoft.NETNative.Analyzer for experimenting with the live code analysis feature. |
The Light Bulb
A light bulb is an icon that will show up on the source code editor suggesting to refactor or fixes for the issues identified by the static code analyzers. Figure 2 shows a sample screen where the light bulb icon has appeared.
Figure 2: The light bulb has appeared
In Figure 2, you should also note that there is an option to preview the changes without actually making them!
Now Evaluate Lambda Expressions
This is a most welcomed feature for developers who tend to write complex lambda expressions in their code. It allows you to evaluate the expression in watch windows or in an immediate window. Figure 3 shows a sample lambda expression in a quick watch window with the sample code on the background.
Figure 3: A simple lambda expression shown in a watch window
If you do the same in the earlier versions of Visual Studio, you will simply get an error message saying “Expression cannot contain lambda expressions.”
Intellitest
Intellitest is a feature that explores the method you wrote and executes the unit test for each line of the code inside that method with different input combinations. The result will be presented in a clean format with details like the parameter value passed, the result, exceptions, details of execution, and so forth. Once you write a method, right-click the method and select “Run Intellitest”. It analyzes your method and runs the tests with different input parameters, including the boundary conditions.
Figure 4 shows a sample Intellitest run on the following code.
public static string FindShape(int height, int width) { if (height == 0 || width == 0) return "None"; else if (height == width) return "Square"; else return "Rectangle"; }
Figure 4: A sample Intellitest run on the preceding code
From the results window, you click the Save icon to create the test cases into physical unit test files. There is also an option to create Intellitest cases with more variety of input parameters and assertions prior to running it.
Check Out the Source Code History on Code Lens
Although Code Lens is a feature originally introduced as part of Visual Studio 2013, there are several enhancements to the feature with the Visual Studio 2015 release. One important such feature is that you can see through the code change history using a code lens without losing focus on the source code editor.
I hope this article rightly coveys my top 7 Visual Studio 2015 features. There are lot more exciting things around the new IDE; I will leave those to the readers to explore.
Happy reading!