What is new in Visual Studio 2017
Technical
Igor let

By Igor Let | Software Developer 09.01.2017.

What’s new in Visual Studio 2017

New version of everyone’s favorite IDE is here (well, the release candidate) with lots and lots of improvements and new features. In this blog post we’re talking about some of them.

Installation

Installation of Visual studio used to be painfully slow and in the end you used to end up with a lot of things you didn’t really need. This has changed. VS 2017 uses a new installer which enables you to choose which specific features you want to have. The core installation weighs only a couple of hundreds of megabytes.

User can easily pick which parts of VS he wants to install. He can choose from large workloads (groups of functionalities) or pick pieces of functionality individually.

In general, this version of Visual Studio is much lighter and faster than previous ones. For example, large projects are opened two times faster than with VS 2015.

Figure 1, installation Figure 1. Installation screen

Navigation

I could never memorize the shortcut for RunToCursor in Visual Studio, it was always difficult to find it among other options in the popup menu and F10 doesn't help much when you are in a loop. The ugly solution was to set multiple breakpoints in a method. Now, when a breakpoint is hit and when you hover the cursor over a line of code, a little arrow appears which enables you to run the code to that line.

Figure 2, Run execution to here Figure 2. Run execution to here

The navigation pane (the one you get when you press Ctrl +, or Ctrl + T) is much better in this version. When you start typing in the search box, suggestions appear and each one shows a preview when it is selected in the list. After you press Enter you actually open the file.

Figure 3. Navigation pane Figure 3. Navigation pane

Find All References window also shows previews now.
As you can see in the previous image, new VS now shows dotted lines connecting pairs of curly braces. When you hover the cursor over the lines it shows the code structure starting with outmost construct and ending with the current one.

Figure 4. Code structure visualization Figure 4. Code structure visualization

Live code analysis and refactoring

Visual Studio lets you refactor your code by pressing Ctlr +. or by clicking on the dotted line under the piece of code that Visual Studio doesn’t like. When you click on it, the suggestion pane appears and code action can be executed. For every code action, there is a preview option which shows you how your code will look like after the change. Style rules are configurable and can be suppressed. Many of suggested code actions can be applied not only to a specific piece of code, but also to the whole project or solution (e.g. you can add braces after each if-statement in the solution).

Figure 5. Code analysis settings Figure 5. Code analysis settings Figure 6. Suggestion mark – dotted line Figure 6. Suggestion mark – dotted line Figure 7. Refactoring action pane Figure 7. Refactoring action pane

Live unit testing

Previous versions of VS could show you if a method is covered with a unit test, but this version goes much further than that. In Enterprise version, there is a new option in Test menu called Live Unit Testing. Instead of just putting a link to the test, when this option is checked, VS actually runs the tests live, while you’re modifying the code, and shows you if they’ve passed or failed. Tests are re-run after every code change. If a method is not covered with a unit test, VS gives you an option of scaffolding one, which speeds things up a lot.

Figure 8. Live unit testing – passed test Figure 8. Live unit testing – passed test Figure 9. Live unit testing – failed test Figure 9. Live unit testing – failed test Figure 10. Live unit testing – test method Figure 10. Live unit testing – test method

JavaScript

Our company is web-oriented, so we are interested in new features related to JavaScript.

The biggest change in that regard is full IntelliSense for JavaScript libraries that have definition files included. So, if you for example add jQuery library in your project, VS will show you suggestions when you start to use it. These can include method names, parameter types and everything else you get when coding in C#.

But that is not all, if you provide comments for your own JS methods, VS will show you IntelliSense for them as well with all information about parameters’ names and types, return type and so on.

As a C# developer, I was never a fan of FireBug or Chrome Developer Tools. With VS 2017, if you use Chrome, there is an option for debugging JavaScript code directly in VS with all the usual features (watch windows, variable inspection, changing values during debugging etc.).

More

I don’t have enough space here to write about all the new features of VS 2017. There are lots of new features regarding .NET Core, Xamarin, Docker, Azure etc. For more info read the release notes.

Igor Let image

By Igor Let | Software Developer 09.01.2017.

Follow him on LinkedIn