What is new in .NET 5?
On November 10, 2020, just 5 minutes before the start of the annual online conference .NET Conf 2020, the .NET 5 download page was updated. What the .NET developers all over the world have been waiting for has come true.
No surprise happened - all innovations and improvements were known long before that moment. We saw .NET 5 RC1 and RC2 earlier in September and October 2020. Many developers have already tried .NET 5 in their projects. However, the moment of release of .NET 5 summed up the huge work that Microsoft developers have done together with many authors of the open source community.
Shortly after the official release of .NET 5, Visual Studio 2019 update 16.8 was released with full support for all features of the new framework. Docker images for .NET 5 and .NET 5 SDK have also been published.
What did we get with the .NET 5 release?
First of all it is the consolidation of frameworks - now instead of separate Core, Mono, Xamarin we have a single .net5.0 target. In fact, the .net5.0 target has come to replace netcoreapp and netstandard. In addition, we can choose the operating system, for example: net5.0-android, net5.0-ios, or net5.0-windows. The framework has become truly cross-platform. We have a set of cross-platform classes and operating system dependent add-ons. In particular, for Windows we have support for the usual WinForms, which was released and rolled out earlier in .NET Core 3.1.
In .NET 5 a lot of work was done to optimize both the direct performance of applications and the speed of compilation of the source code. Now we will reduce the time required to pass our tests and nightly builds in CI.
As for the performance of the code, the .NET 5 application took second place after Rust app in the tests for the number of gRPC queries per second and was ahead of the program code compiled from Go (a diagram from the blog).
The next most important innovation of .NET 5 is the inclusion of a new version of C# 9. I think the most interesting innovation is the introduction of records. The new syntax greatly simplifies the description of immutable data models compared to traditional classes. We have a simple syntax of declaration and initialization.
public record Animal
{
public string? Name { get; init; }
public string? Areal { get; init; }
}
var brownBear = new Animal { Name = "Bear", Areal = "Siberia" };
var whiteBear = animal with { Areal = "Arctic" };
In the innovations of the language we can also note the possibility of writing the program code without using the main() function. Now you can write code at the top level.
using System.Console;
WriteLine("Hello World!");
The .NET 5 also includes the F# 5 and Visual Basic languages. The VB is somewhat limited in capabilities compared to major languages, but nevertheless Microsoft continues to support it.
I found it interesting to include the .NET 5 installer ClickOnce. It is now possible to publish the application as an installation package that you can run on your computer and deploy the application there. The entire framework can be included in the installation. This will increase the size of the distribution, but will make it easier to install on a new computer.
We also see the continued evolution of the Single File Application feature, known to us from .NET Core 3.1. It is possible to create a single executable file that contains all libraries with the ability to embed all used framework libraries. Now the files are smaller, and they run faster.
The Blazor framework has been improved. Among them is CSS isolation, which will allow to manage the styles of each component and prevent conflicts between styles of other components and libraries.
The new .NET ecosystem will have LTS (Long Time Support) status only for even versions. For example, .NET 5 will not have a long-term support status, and .NET 6 will have a long-term support status. In other words, we will see the following releases: .NET 6 LTS, .NET 7, .NET 8 LTS, etc.
These are not all .NET 5 innovations, they are just highlights that I keep in mind. There are much more new features and I can write a lot about them for a long time. Perhaps I will write a sequel or separate articles looking at specific examples and how to use .NET 5 in real applications.
What happens now to the .NET Framework 4.8? Nothing. Its further development is frozen, only critical updates will be released.
Web Forms and WCF have also been abandoned - ASP.NET Core Blazor and gRPC are proposed instead.
We got a second life for Windows Forms as part of .NET 5 (the beginning was in .NET Core 3.1). Will WinForms support be extended for Linux and macOS .NET 6? Let's wait and see. In any case, the migration of WinForms applications to the .NET 5 framework may simplify further migration to the expected future Blazor Desktop.
In conclusion, I would like to say that a lot of work was done and in the form of .NET 5 we got a real opponent to the Java platform and many other solutions for developing Enterprise applications. We are looking forward to new features and bug fixes from the .NET development team.
We have prepared for .NET 5 - our FastReport .NET Core and FastReport Open Source libraries support .NET Standard 2.1 and can be used in .NET 5 applications. In the future we plan to extend WinForms support for .NET 5 and we already have the related practices for .NET Core 3.1.
Thank you for your attention, let’s run .NET 5!
Author: Aleksandr Fediashov
Comments
Post a Comment