How to get started with Visual Studio 2019: The best new features whatever your programming language

The latest features in Visual Studio 2019 and how to use them.

The best programming languages to learn in 2019: Top coding skills that pay you the most These are the languages that are in the highest demand and offer the highest salaries.

Visual Studio 2019 is generally available today, bringing with it a slew of new features aimed at making developers more productive.

Microsoft has used the release to build real-time collaboration and GitHub integration directly into Visual Studio, while also making refactoring and debugging code simpler and using machine learning to improve intelligent code suggestions and search.

In the Stack Overflow Developer Survey last year, Visual Studio was named as the second most popular integrated development environment (IDE) used by programmers to create software.

These new features in the latest release of the IDE are designed to work with a wide range of programming languages and platforms - from cross-platform C++ applications, to .NET mobile apps for Android and iOS written using Xamarin, to cloud-native applications using Azure services.

Amanda Silver, partner director of program management at Microsoft, said the new features in Visual Studio 2019 were based on addressing the "biggest pain points" for developers in areas ranging from team collaboration to deploying software on multiple platforms.

SEE: 10 ways to prevent developer burnout (free PDF) (TechRepublic)

"That's really the inspiration behind the Visual Studio 2019 release," she said, adding that Visual Studio today was suited to developing in a broad range of programming languages.

"A lot of people see Visual Studio as just a C# or C++ Windows tool and really Visual Studio has expanded over the last few years to cover really any programming language for any platform."

Another improvement over Visual Studio 2017 is performance, with Silver saying the time it takes to open a project, run testing, and other common tasks should be "dramatically improved".

Visual Studio 2019 launches on both Windows PC and Mac today, with the headline features for the Mac release being a new C# editor, a fresh Start window, the ability to run multiple instances of Visual Studio, and new Xamarin and Unity game engine tools.

Here's the best new features in Visual Studio 2019 and how to use them.

Visual Studio Live Share

Live Share allows multiple developers to collaborate and to jointly edit the same code in Visual Studio 2019 in real time.

Up to 35 developers can work together on code at the same time and Live Share can be used to allow users of Visual Studio 2019 and the simpler Visual Studio Code editor to collaborate.

"We have found that to be incredibly altering in terms of how developers actually do their development," said Silver, adding it had been particularly useful for groups learning how to code.

Visual Studio 2019 embeds the Live Share capability into Visual Studio by default, with a Live Share button in the IDE, as seen below on the lefthand side of the screen.

pic1.png
Image: Microsoft

Sharing a session with another developer is relatively straightforward, simply requiring you to click on the Live Share button, hit 'Start collaboration session'.

pic2.png
Image: Microsoft

Next you need to click 'Invite participants', which will copy a link to the Live Share session to your clipboard, which can then be sent to other Visual Studio users you want to invite. Sessions can also be made read-only, as you can see, by clicking the button in the pop-up notification.

pic3.png
Image: Microsoft

You can see how Live Share is embedded into VS from this example when debugging code. This exception in the code brings up a dialog window that includes an option to 'Start Live Share session'.

pic35.png
Image: Microsoft

Again, clicking this option copies a link to the clipboard which can then be sent to another Virtual Studio user to start a Live Share session, who is then able to start editing code.

Much like real-time document editing, you can see the edits the other person makes via a colored cursor with their name hovering over the top. There's also an audio channel so you can talk to those collaborating with you, if you wish.

pic4.png
Image: Microsoft

As well, as editing code, developers will be able to perform other actions, such as adding breakpoints for debugging.

Live Share can also be augmented using third-party extensions, such as the OzCode C# debugging extension and the CodeStream commenting and discussion platform.

Smarter IntelliCode

Visual Studio 2019 upgrades IntelliCode's intelligent suggestions, with a wider range of AI-powered assistance for the autocomplete and auto-formatting feature.

The IntelliCode upgrade means suggestions will be personalized to each user, giving them recommendations based on their code.

"We're really trying to make sure you can write the most productive code as quickly as you possibly can and that you can learn from what your team and others are writing as you type," said Silver.

You can see the new IntelliCode feature in action below, and how it uses a trained machine learning model to predict the most likely item to be inserted at a particular point in the code.

For example, clicking inside the parentheses when calling a method might prompt IntelliCode to suggest a likely parameter to pass to that method, in the example below correctly suggesting the appropriate first parameter would be the banana variable holding an instance of the Banana class.

pic1.png
Image: Microsoft

The suggestion is flagged up to the user by moving it to the top of the dropdown suggestions list and marking it with a star.

IntelliCode will also now work with the XAML and C++ languages.

New search

The new Visual Studio search box, seen at the top of the screen, is designed to find anything in Visual Studio — including menu items, tool windows, settings, and more.

The tool uses fuzzy logic that aims to return the correct information even if you make a typo.

pic1.png
Image: Microsoft

For example to change the font, you'd type 'font' into box, which opens the Options menu, with Fonts and Colors selected, with no need to dive into the menus to find the correct Settings.

pic2.png
Image: Microsoft

Another example of how the search box can be used is to look for new classes, as you can see below, where searching for 'add class' in the search box brings up the 'Add New Item' dialog window.

pic4.png
Image: Microsoft

Select 'Class' from the top of the menu, and type the name of the class in the 'Name' box, in this instance a class called 'banana'.

pic5.png
Image: Microsoft

The window for this new class will automatically open.

Code Cleanup

Visual Studio can be configured to check your code against the code style that you or your team has defined, using the new Code Cleanup feature.

To configure Code Cleanup, click on the tiny arrow next to the broom icon at the bottom of Visual Studio and select 'Configure Code Cleanup'.

pic1.png
Image: Microsoft

As you can see, Code Cleanup can be configured to use multiple code style profiles.

pic2.png
Image: Microsoft

Once the desired profile is selected, cleaning the whole document can be accomplished by clicking the Code Cleanup broom icon.

pic3.png
Image: Microsoft

GitHub repos available from the Start window

As you can see, you can now clone or check out a GitHub repository directly from the Start window.

pic1.png
Image: Microsoft

This option allows you to paste in a GitHub repository URL or access your Azure DevOps repositories.

pic2.png
Image: Microsoft

"Nowadays when people are starting a new project, they tend to go to a Git repository first, and so we really wanted to make sure this was first and foremost in the developer experience in the new product," said Silver.

Pull Request extension

This adds a Pull Request button in the Team Explorer sidebar in Visual Studio.

pic1.png
Image: Microsoft

Clicking the button allows you to create a new Pull Request, where you can title and describe your request, as well as copying in other developers, before submitting the request.

pic2.png
Image: Microsoft

The sidebar also lists any Pull Requests made against your own code.

pic3.png
Image: Microsoft

Clicking on each request brings up an option to open the request, to view a description of the request, discussion comments, as well as a side-by-side comparison of the files changed with any alterations highlighted — as shown below.

pic4.png
Image: Microsoft

Once you're happy with the suggested changes to the code, that Pull Request can be approved from inside of Visual Studio.

Fewer crashes when debugging large C++ apps

One new feature should help C++ developers who debug very large applications, such as video games.

"We've taken more of what Visual Studio does and made it asynchronous, so it's executing on a different thread," said Silver.

"One of the big features of Visual Studio 2019 that is really a delight for C++ developers who are building large-scale C++ applications is that we've moved the debugger to be out of process."

She said commercial teams at places such as Tableau Software, Adobe and Epic Games had said that the changes had resulted in "a night and day improvement" when working on large codebases.

The changes should result in far fewer crashes due to a lack of memory when debugging very large code bases compared to previous versions of Visual Studio.

Here you can see the Xbox game Gears of War 4 being debugged in Visual Studio 2017, an example of a C++ application with a large memory footprint.

pic1.png
Image: Microsoft

The memory use ticks up very quickly, with devenv.exe consuming 2GB of RAM after five minutes of debugging the code, rapidly heading towards an out-of-memory error.

In contrast the amount of memory used to debug the same code base in VS 2019 is significantly lower, with about 418MB consumed after five minutes.

"Basically it's not occupying such a lot of memory in the main process and so where you used to run into out of memory exceptions in the debugger, you no longer end up with that kind of situation," said Silver.

"For large AAA games or large ISV applications, it used to be they could debug for maybe 10 minutes and then run into these errors and have to start over, now it's just like any other kind of debugging, where you can debug for hours."

New ways to debug code

Data breakpoints that were available for C++ in previous versions of Visual Studio are now available for .NET Core applications.

These breakpoints allow Visual Studio to watch a specific object's property, even when it goes out of scope, and to halt the application when that property changes so it can be inspected.

To set a data breakpoint, you can search for the object you're interested in using the new search tool, as shown below.

pic1.png
Image: Microsoft

Next drill down into the dropdown menus to locate the object property you want to track.

pic2.png
Image: Microsoft

Right click that property and select 'Break When Value Changes'.

pic3.png
Image: Microsoft

Then click the 'Continue' button at the top of the screen, or hit F5, which will cause the application to continue running until that property is modified, and you will receive a notification showing you when and where that change occurred.

pic4.png
Image: Microsoft

The feature has various uses, such as finding where a global object is being modified or when an object is being added or removed from a list.

Simpler code refactoring code for C#

There are new options for more rapidly refactoring code written in C# using context-sensitive dropdown menus.

For example, to move a method into the interface that a class implements, hit "CTRL + .". This brings up a dropdown menu, from which you can select the 'Pull up' option for that method and then the interface you want to pull the method up to, as shown below.

pic1.png
Image: Microsoft

To wrap method parameters, again select the method, hit "CTRL + .", and select 'Wrap every parameter' from the dropdown menu.

pic2.png
Image: Microsoft
  • If you want to learn more about Visual Studio 2019 you can also visit online learning platform Pluralsight, which has partnered with Microsoft to offer a new, free, Visual Studio 2019 course until April 22nd, or LinkedIn Learning, which has a new Visual Studio 2019 course that will be free until May 2nd.

Also see

By Nick Heath

Nick Heath is chief reporter for TechRepublic. He writes about the technology that IT decision makers need to know about, and the latest happenings in the European tech scene.