Abstract: The .NET ecosystem including .NET Core, .NET Standard, C# and Visual Studio 2019 introduced many changes and new features in the year 2018. This article talks about these new feature updates and highlights how it will affect the way we develop applications in the future.

What Was New for .NET Developers in 2018 & the Road Ahead

2018 was a busy year both for Microsoft, as well as for the developer community working on Microsoft & Open Source technologies. Many new important releases and announcements were made at different Microsoft events in 2018.

This article covers the most important ones, as well as the other releases which didn’t coincide with a specific event.

New .NET Versions and Features in 2018

.NET Core and .NET Standard

During the year 2018, the development of .NET Core continued at full speed and several important releases were made available.

.NET Core 2.1

In May 2018, .NET Core 2.1 was released. Its main focus was performance:

Build times were drastically improved. Build time for a Large project got 10 times faster than before.

A new memory efficient type Span<T> was introduced which provided an isolated view of a part of a larger array without any memory operations. It is very useful for efficient parsing and other processing of large inputs.

was introduced which provided an isolated view of a part of a larger array without any memory operations. It is very useful for efficient parsing and other processing of large inputs. Span<T> was used to implement a new HttpClient class for better networking performance.

was used to implement a new class for better networking performance. A lot of work has been done on the JIT (just-in-time) compiler to improve the runtime performance of applications.

New features were also introduced. The most important ones are:

- The Windows compatibility pack includes 20 thousand APIs from the .NET framework which are not included in .NET Core itself (e.g. System.Drawing namespace, support for Windows services, registry, EventLog etc.). It can primarily be used to make porting of existing .NET framework applications to .NET Core, easier. Despite its name, it’s available not just for Windows but about half of the APIs are also implemented on other platforms. The rest throw an exception (as of this writing) when invoked on a non-Windows OS.

- .NET Core Tools represent a new (NuGet based) way for deploying command line (CLI) tools written in .NET Core. They are modelled after NPM (Node Package Manager) global tools. A tool can be installed using the following command:

dotnet tool install -g dotnet-serve

It will be added to the path and can later be invoked using only its name:

dotnet-serve

The dotnet-serve tool here is a simple HTTP server. A list of available tools is maintained on GitHub.

.NET Core 2.2

Just before the end of the year, in December 2018, .NET Core 2.2 was released. It didn’t have as many improvements as .NET Core 2.1. Most changes were introduced to ASP.NET Core, e.g.:

Better support for Open API (Swagger) descriptors for HTTP (REST) services. Customizable conventions were added as a simpler alternative to individual documentation attributes. A diagnostic analyzer is included for detecting mismatches between the code and the documentation attributes (you can read more about diagnostic analyzers in my DNC Magazine article Diagnostic Analyzers in Visual Studio 2015).

A new router with improved performance and a better globally available link generator.

Entity Framework Core was also expanded with support for spatial data.

Although .NET Core 2.2 was released after .NET Core 2.1 and includes several new features, it’s recommended to still use .NET Core 2.1 for most applications, because it has a different support policy. .NET Core 2.1 was released as an LTS (Long Term Support) version which means that it will be supported for 3 years after its initial release (August 2018 when .NET Core 2.1.3 was released), or one year after the release of the next LTS version (whichever happens later).

In contrast, .NET Core 2.2 was released as a Current version. As such, it will only be supported for 3 more months after the next version of .NET Core is released (either Current or LTS).

.NET Core 3.0

Also, in December 2018, .NET Core 3.0 preview 1 was released. It’s the first public preview of the next major version of .NET Core.

Its main new feature is the ability to create Windows desktop applications using Windows Forms or WPF (Windows Presentation Foundation). Both UI frameworks are extended with support for hosting UWP (Universal Windows Platform) XAML controls when targeting Windows 10 only. These controls provide access to modern browser and media player controls, as well as better touch support. .NET Core implementations of all three UI frameworks (Windows Forms, WPF and UWP) were open sourced.

The main use case for .NET Core Windows desktop applications is porting of existing .NET framework desktop applications, to .NET Core. To make it even easier, the latest version of Entity Framework 6 is being ported to .NET Core as well.

Although recompiling existing .NET framework applications for .NET Core won’t make them cross-platform because the UI frameworks are only available on Windows, it will still allow them to take advantage of other .NET Core benefits:

Improved performance of .NET Core in comparison to the .NET framework.

Support for application local deployment (in addition to global deployment) of the .NET Core version that the application uses. This will allow different applications to use different versions of .NET Core which is currently not possible with the .NET framework.

.NET Core 3.0 will also bring other new features:

Further performance optimizations (improved Span<T> and String types, faster JSON library based on Span<T> , JIT compiler optimizations).

and types, faster JSON library based on , JIT compiler optimizations). Local installation of .NET tools which will make it easier to restore local development environment and use a specific version of a tool with a project.

Improvements based on new C# 8 features, such as asynchronous streams and default implementations of interface members (you can read more about new features of C# 8 in my DNC Magazine article C# 8.0 – New Planned Features).

.NET Standard 2.1

According to the currently available information, the final release of .NET Core 3.0 will also be accompanied with the release of .NET Standard 2.1 (you can read more about .NET Standard in my DNC Magazine article .NET Standard - Simplifying Cross Platform Development). It is planned to include around 800 new APIs which were added to .NET Core 2.1 and later versions. The most important additions will be:

ValueTask and ValueTask<T> for more efficient asynchronous code (you can read more about these types in my DNC Magazine article C# 7 - What's New).

and for more efficient asynchronous code (you can read more about these types in my DNC Magazine article C# 7 - What's New). Span<T> and new members in existing types which support it.

and new members in existing types which support it. Dynamic generation of code through reflection emit (it will not be supported on platforms which don’t allow dynamic code generation).

.NET Standard 2.1 will be implemented by .NET Core 3.0 on release. It will also be supported by future releases of Xamarin, Mono and Unity. There are no plans to support .NET Standard 2.1 in future versions of the .NET framework.

What’s new in Visual Studio?

Visual Studio 2017 minor updates continued to be released in the year 2018. However, the current minor version (15.9) is the last minor update for Visual Studio 2017. From now on, only servicing updates will be released for it with bug fixes only and no new features.

New features will now target Visual Studio 2019. Its final release date has not been announced yet, but the first preview version is already available for download.

Visual Studio 2017

Four new minor updates for Visual Studio 2017 were released throughout the year (versions 15.6 - 15.9). Like the previous updates, they were mostly maintenance releases with a small set of new features.

Most importantly, support was added for new versions of other products which were released during that time: C# 7.3, .NET framework 4.7.2, .NET Core 2.1 and 2.2, and UWP (Universal Windows Platform which was part of the Windows 10 update).

Other important features were:

Improved F# support for .NET Core.

Built-in Continuous Delivery configuration for Azure DevOps.

Support for Hyper-V based Android emulator.

Improvements to Visual Studio Installer for better upgrade experience.

Performance improvements were included as well, most notably for solution loading and testing.

The released minor versions also incorporated many bug fixes. Therefore, it makes sense to regularly install the updates even if you don’t need any of the new features. The notifications inside Visual Studio make sure you don’t forget to do that, and the Visual Studio Installer makes the update process quick and simple.

Visual Studio 2019

At the Microsoft Connect() 2018 event in December, Visual Studio 2019 Preview 1 was released. This will be the first major new version of Visual Studio since the release cadence of minor versions increased with Visual Studio 2017. This means that Visual Studio 2019 is introducing several large new features which required more work and couldn’t be safely added to Visual Studio 2017.

User interface redesign

As soon as you start Visual Studio 2019, you will notice the first major change. The Start Page from Visual Studio 2017 has been reworked into a completely new Start Window which opens before the main window of Visual Studio 2019. The only new feature of the Start Window in comparison to the Start Page is the option to open a new project from an existing source control repository.

Figure 1: Visual Studio 2019 Start Window

The next change awaits you when you decide to create a new project. After many years, the wizard for creating a new project has been completely redesigned. The hierarchical view of templates has been replaced by a more flexible search as well as some filtering options.

Figure 2: New project wizard in Visual Studio 2019

The final big user interface change will reveal itself when you reach the main window of Visual Studio 2019. The title bar at the top has been removed to leave more space for the code editor. The menu bar and toolbar have been reorganized accordingly to keep all existing functionality.

Figure 3: Title bar, menu bar and toolbar in Visual Studio 2017

Figure 4: Menu bar and toolbar in Visual Studio 2019

The quick launch feature has also been improved to better handle typos and show more information about the displayed search results.

Figure 5: Improved quick launch feature in Visual Studio 2019

All these features are still experimental and subject to change based on the feedback received from the users. For some reason, if a feature doesn’t work for you or you do not want it; but you would like to keep using Visual Studio 2019, there is now an option to opt-out of a specific experimental feature.

Figure 6: Opt-out options for experimental features

Productivity

There are also a lot of productivity improvements in Visual Studio 2019 which aren’t immediately visible but should make you more efficient in all phases of the development process.

To speed up the initial loading of large solutions, you can now configure which projects do you want to load automatically and which you want to keep unloaded initially. You can also choose not to restore the state of tool windows and the Solution Explorer tree view to further reduce the startup time.

To save you time spent on writing code, several code fixes were added for refactoring code, e.g. for converting a local function to a method, a tuple to a struct, an anonymous type to a class or struct, etc. You can now get a quick overview of all the errors, warnings and suggestions in each file by looking at the document health indicator in the bottom right corner of the code editor window. Its tooltip gives a more detailed overview and allows you to navigate between issues. From its context menu, you can configure or invoke code cleanup to automatically fix some of these issues.

If you’re using regular expressions a lot, you’ll appreciate the new built-in support for them in the code editor, such as syntax highlighting, brace matching and diagnostics. Regular expressions are automatically recognized when passed to the Regex constructor, but you can also tag them yourself using a special comment syntax.

During debugging you can take advantage of improvements in the Auto, Watch and Locals windows. The search functionality will help you find the correct variable by name or value stored in it. You can use format specifiers to format the values differently. For .NET Core projects, support for custom visualizers has been added.

A subset of tests can now also be run from the Solution Explorer context menu. Code metrics can finally be used with .NET Core projects. You don’t need a third-party add-on for that anymore.

Team Explorer now supports Git stashes. The experience with Azure DevOps (formerly named Visual Studio Team Services or VSTS) work items has been completely redesigned. It’s now focused around the developer workflow with built-in filters and automatic association of work items to local branches. For better experience with Azure DevOps pull requests, you can install an extension for reviewing, running and debugging them inside Visual Studio.

If you’re curious about the new upcoming C# 8 features, you can try some of them out (nullable reference types, ranges and asynchronous stream, to be exact). For all of them to work, you will need to create a .NET Core 3 project and manually select the C# 8 beta language version in the Advanced Build Settings of Project Properties (you can find detailed instructions on changing the language version in my DNC Magazine article C# 7.1, 7.2 and 7.3 - New Features (Updated)).

Visual Studio Live Share

At Build 2018 in May, a public preview of Visual Studio Live Share was released as an extension for Visual Studio 2017 and Visual Studio Code. The functionality is built into Visual Studio 2019 Preview 1.

Visual Studio Live Share was designed as an improved experience over screen sharing for remote collaboration between developers. Instead of both developers looking at the same screen with only one of them having control at the same time, each of them can now work on the same code from her/his own screen.

The guest gets full access to the host’s project without having to download the project code locally. As the host and the guest independently navigate the code, they both see the changes either one of them makes, in real time. The guest can also collaborate in the debugging process although the code is running on the host’s computer.

The tool can be very useful for remote pair programming, code reviews and in educational scenarios.

Visual Studio IntelliCode

Another feature introduced at Build 2018 was Visual Studio IntelliCode. This extension for Visual Studio 2017/2019 and Visual Studio Code helps the developer with AI assisted functionalities.

IntelliSense suggestions are improved by using machine learning on the publicly available code repositories. This allows the IntelliSense feature to suggest the most relevant API and overload based on the surrounding code. The supported languages depend on the IDE chosen:

In Visual Studio 2017 and 2019 C#, XAML and C++ are supported.

In Visual Studio Code TypeScript/JavaScript, Python and Java are supported.

For C#, you can even train your own model on private code repositories.

Visual Studio 2017/2019 can also infer the formatting and code style conventions from existing code in the solution. It can generate an .editorconfig file for you which can be used to enforce conventions from then on.

Since the original release of the extension in May 2018, new features have been constantly added to it. It is very likely that additional features will be added in the future.

Conclusion:

With the announcement of support for Windows desktop applications in .NET Core 3.0, it became clear that .NET Core is replacing .NET framework as Microsoft’s main development platform. Like it or not, .NET framework is now a legacy product. The upcoming version 4.8 is only a maintenance release with no major new features. For all new projects, .NET Core should be used unless the scenario is not (yet) supported by it.

The development of Visual Studio continues steadily. The announcement of Visual Studio 2019 means that after two years of minor updates with only a minimum number of new features, we can again expect some larger changes in 2019. You can take some of these features for a spin in the recently released preview.

This article was reviewed by Suprotim Agarwal.

This article has been editorially reviewed by Suprotim Agarwal.

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn. We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle). Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview. Click here to Explore the Table of Contents or Download Sample Chapters!