BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Microsoft Releases .NET 5

Microsoft Releases .NET 5

This item in japanese

Bookmarks

Earlier today, at .NET Conf 2020, Microsoft released .NET 5 (with a simultaneous announcement on their development blog). The new release focuses on improvements of .NET Core 3.1: smaller single-file applications, support for Windows ARM64, and more capable JsonSerializer APIs are among the key features of .NET 5, along with many considerable performance improvements. New major language versions (C# 9 and F# 5) are also featured as part of this release.

(Image source: Scott Hunter's presentation at NET Conf)

Last year, Microsoft announced that .NET 5 would be a unifying platform for desktop, Web, cloud, mobile, gaming, IoT, and AI applications. At the time, the goal was to produce a single .NET runtime and framework, cross-platform, integrating the best features of .NET Core, .NET Framework, Xamarin, and Mono (the original cross-platform implementation of .NET). However, due to the global health pandemic, the unification was postponed to .NET 6 (expected to be released in November 2021). During the release event at .NET Conf, Scott Hunter, director of program management at Microsoft on .NET, reaffirmed the continued mission of achieving a unified platform:

We continue the journey of unifying the .NET platform. Our vision for one .NET is a unified set of libraries, tools, SDKs, and runtimes. .NET 5 begins this journey by taking everything available at .NET Core and adding several cloud and web investments [...].

The unified platform vision was also reinforced by Richard Lander, principal program manager at Microsoft on .NET Core. Despite the changes in the original scope, however, .NET 5 brings many improvements over .NET Core 3.1, along with a few new features. One of the most relevant features in this release is the addition of support for Windows ARM64, enabling .NET to run natively on such platforms. As a result, devices such as the Surface Pro X will be able to run Windows Forms, WPF, and ASP.NET Core apps.

Another important feature in this release is the improvement of single-file applications. Single-file applications are published and deployed as a single file, which includes the app and all of its dependencies. They can also be self-contained, which means they carry their own .NET runtime - which is particularly interesting for apps that depend on a specific runtime version. .NET 5 brings smaller single-file applications with more efficient memory usage and that are "more appropriate for microservices containerized applications across various operating systems" (as stated by Hunter). However, it is essential to notice that single-file apps in .NET 5 are primarily focused on Linux - apps for Windows and macOS still need extra files (the native runtime binaries). This situation will be revisited in .NET 6.


.NET 5 also includes performance improvements in different areas: the garbage collector (GC) was considerably improved with more efficient collection, improved scalability on machines with higher core count, and many other micro-optimizations. The release also features a new version for the Just-In-Time (JIT) compiler with improved hardware intrinsics (including ARM64) and API optimization. Roslyn - the .NET Compiler Platform used to compile C# and Visual Basic code to Interpreted Language - was also improved with new performance-focused Analyzers and the introduction of C# Source Generators. Source Generators let developers inspect user code and generate new source files that can be added to a compilation. In some scenarios, they can be used to replace runtime reflection calls at runtime and IL weaving.

Other relevant performance improvements in .NET 5 include: regular expressions, HTTP 1.1 request handling, HTTP/2 scaling, and string patterns. There were significant improvements made to the JSON API already ported back to .NET Core 3.1, but .NET 5 features a better JsonSerializer with improved collection handling and a new caching layer. The gRPC framework also received special attention: Microsoft's benchmarks show a considerable performance increase over .NET Core 3.1 (60% faster in the server, 230% faster in the client). Since gRPC uses HTTP/2 as its underlying protocol, the new HTTP/2 implementation is also partially responsible for the observed performance increase. Related changes in the Google.Protobuf package - such as adding support for modern .NET IO types (Span<T>,ReadOnlySequence<T>, and IBufferWriter<T>) - also had a direct impact on the gRPC performance. A comprehensive list of all performance improvements in .NET 5 can be found here.

(Image source: Scott Hunter's presentation at NET Conf)

The new release also features reduced container image sizes, new container APIs, and new target framework names. In .NET 5, target frameworks are specified in the .csproj project files with Target Framework Monikers (TFMs), which are short codenames used to identify the set of APIs targeted by a project:

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>


The ASP.NET Core framework also received new features, performance improvements, and compatibility modifications. The new features include Azure AD authentication with Microsoft.Identity.Web, support for parallel hub invocations in SignalR, and Open API Specification (Swagger) on-by-default in ASP.NET Core API projects. Performance improvements to Blazor WebAssembly focused on complex UI rendering (component virtualization and pre-rendering) and JSON serialization. As a result, Blazor WebAssembly in .NET 5 is 2-3x faster than Blazor WebAssembly 3.2 for most scenarios.

Finally, there are also many relevant language updates in .NET 5: C# 9 focuses on program simplicity and data immutability, bringing several new features such as Records, top-level statements, and improved pattern matching. F# 5 also comes with many performance improvements and two highly-requested new features: Interpolated Strings and Open Type Declarations (similar to open static classes in C#). F# 5 is also fully supported in Jupyter Notebooks, nteract, and VSCode Notebooks. As expected, the development toolchain was also updated: new versions of Visual Studio 2019 (16.8 for Windows and 8.8 for Mac) were also released today (with .NET 5 already included), and ClickOnce application deployment is now supported for both .NET Core 3.1 and .NET 5.

According to Microsoft, .NET 5 is already ready to be deployed into production: the .NET website and Bing.com have been running on .NET 5 since its first preview release, and it is also "already in active use by teams at Microsoft and other companies, in production and for performance testing", as stated in the official release note. The complete release notes for .NET 5 can be found here, and a comprehensive list of breaking changes for migration from .NET Core 3.1 to .NET 5 - which includes a new model for supporting WinRT APIs - can be found here. The first preview of .NET 6 is expected at the end of the year. The current .NET development roadmap is available here.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT