What’s new in Microsoft .NET 6


Microsoft has published the fifth preview of .NET 6, the next generation of the company’s software development platform that will finish the parts of the .NET unification begun in .NET 5. An updated SDK workloads capability is highlighted in the latest preview, for supporting new application types.

Due as a production release in November, .NET 6 is set to deliver improvements for cloud, desktop, and mobile apps. Preview 2 was published March 11, following the initial preview that arrived February 17. Monthly previews are planned between now and the production release, which will be supported for three years. Each preview will deliver on .NET 6 themes, epics, and user stories for developing server/cloud, desktop, IoT, and mobile applications.

Microsoft .NET 6 will integrate capabilities for Android, iOS, and MacOS that currently reside in the Xamarin open source mobile .NET platform. Microsoft also is extending the Blazor client web app development tool, so developers can build a hybrid client app that combines web and native UIs for desktop and mobile usage. Blazor WebAssembly was the first unified platform deliverable in .NET 5. Published in November 2020, .NET 5 marked the beginning of unification and laid the groundwork for Xamarin developers to use the unified .NET platform when .NET 6.0 arrived.

The .NET unification creates one .NET from the separate .NET Core, .NET Framework, and Xamarin/Mono technologies. Parts of .NET Framework already had moved to .NET Core; .NET 5 began the journey of combining .NET Core and Mono/Xamarin on a base class library and toolchain.

Unveiled June 17, Preview 5 can be downloaded from dotnet.microsoft.com. It is considered by Microsoft to be perhaps the biggest preview yet in terms of breadth and quantity of features. Capabilities highlighted in a bulletin on the release include:

  • SDK workloads, part of the .NET unification vision, supports additional application types such as mobile and WebAssembly without increasing the size of the SDK. The feature has been updated to include list and update verbs, with the dotnetworkload list capability telling a developer which workloads have been installed and the dotnet workload update feature used to update all installed workloads to the newest available version. Serving as a package manager, SDK workloads was introduced in Preview 4.
  • Package validation tools enable NuGet library developers to validate that packages are consistent and well-formed.
  • More analyzers for the Roslyn compiler platform.
  • For the SDK, custom guards are enabled for the Platform Compatibility analyzer,
  • For Windows Forms, a default font can be set for an application.
  • Extensions APIs have been improved, with a focus on hosting and dependency injection.
  • WebSocket compression for libraries reduces the amount of data transmitted over a network.
  • Support for older frameworks is being dropped, including frameworks older than .NET Framework 4.6.1, .NET Core 3.1, and .NET Standard 2.0.
  • A source generator is being introduced in .NET 6 as part of text.json to reduce startup time, improve throughput, and reduce private memory usage.
  • For Objective-C interop, a new .NET API enables a single experience across runtimes.
  • OpenTelemetry Metrics API support has been added. OpenTelemetry, which has been supported in recent .NET versions, promotes observability.
  • OpenSSL 3 support has been added for cryptography on Linux.

Released May 25, Preview 4 established a solid base for the final .NET 6 build, having finished features and experiences. “Go live” builds, which are supported in production, are anticipated in August.

In its bulletin on Preview 4, Microsoft cited eight themes for .NET 6:

  • Appealing to new developers and students.
  • A great client development experience.
  • Being recognized as a compelling framework for building cloud native apps.
  • Delivering simpler and more predictable models for using .NET with mission-critical apps and more closely catering to the needs of large enterprise and government customers.
  • Improving “inner loop” performance for .NET developers, with productivity improvements for build performance, hot restart, and hot reload.
  • Growing the .NET ecosystem through increased confidence, quality, and support.
  • Improving startup and throughput using runtime execution information.
  • Meeting developer expectations.

New features in Preview 4 include:

  • Improvements to Hot Reload, providing an experience to make edits in source code while the code is running without needing to manually pause an app or hit a breakpoint. Developer productivity is improved. With this release, Hot Reload works for many types of apps such as WPF, Windows Forms, WinUI, ASP.NET, Console Apps, and other frameworks on top of the CoreCLR runtime. The technology also is to be brought to WebAssembly, iOS, and Android apps that run on Mono at a later date.
  • Text.Json support for IAsyncEnumerable, enabling System.Text.Json (de)serialization with IAsyncEnumerable<T> objects. System.Text.Json now supports serializing IAsyncEnumerable<T> objects as JSON arrays.
  • The writeable JSON DOM feature as a straightforward and high-performance programming model for Text.Json, providing an API to avoid complexity of serialization and the traditional cost of a DOM.
  • Significantly improved FileStream performance on Windows.
  • A LoggerMessageAttribute type source-generates performant logging APIs.
  • Linq enhancements with new APIs.
  • RyuJIT compiler improvements.
  • Enhanced date, time, and time zone support.
  • For IL (intermediate language) trimming, warnings are enabled by default. Trim warnings apprise developers about places where trimming may remove code that is used at runtime.
  • Single-file application publishing improvements including improved analysis to allow for custom warnings.
  • Single-file bundles now support compression.
  • Built-in SDK version checking is provided.
  • Crossgen2, to generate and optimize code via ahead-of-time compilation, is now enabled by default when publishing ReadyToRun images.

Preview 3, unveiled on April 8, featured the following additions and improvements:

  • A new unsafe API, CollectionsMarshal.GetValueRef, makes updating struct values in dictionaries faster. This API is intended for high-performance scenarios.
  • Interface casting performance has been improved by 16 percent to 38 percent, which is particularly useful for C# pattern matching to and between interfaces.
  • Code generation has been improved in RyuJIT via multiple changes, to make the process more efficient or resulting code run faster.
  • Early support for .NET Hot Reload became available for ASP.NET Core and Blazor projects using dotnet watch. This was the first step in a more comprehensive plan to bring this technology to all .NET developers, supporting desktop development, cross-platform client scenarios in .NET MAUI (Multi-platform App UI), and more.

Preview 2, published March 17, featured API and library improvements, runtime performance boosts, and early builds of .NET MAUI (Multi-platform App UI), which is a modern UI toolkit that builds upon Xamarin. Microsoft’s bulletin on Preview 2 also emphasized themes for the platform such as improving “inner loop” performance, i.e., optimizing the tools and workflows used frequently and repeatedly by developers to update, build, and test their code. Hot reloads, for example, will improve developer productivity by enabling code to be edited while an app is running, even without a debugger attached. Runtime startup performance, application models, the dotnet CLI, and MSBuild are also getting attention as part of the inner loops theme.

Another theme is improving the client app development experience, including a more unified mobile product for .NET. As part of this effort, iOS, Android, and MacOS development will be integrated into the .NET SDK experience and use .NET libraries. In addition, the Xamarin.Forms cross-UI framework is evolving into .NET MAUI, which will allow developers to create apps for Android, Windows, and MacOS from the same codebase. Blazor apps will run natively on Windows and MacOS via .NET MAUI.

Microsoft also touted the addition of APIs and improvements to .NET libraries. For example, JsonSerializer (System.Tex.Json) now supports the ability to ignore cycles when serializing an object graph, while PriorityQueue<TElement.TPriority> is a new collection that enables the addition of new items with a value and a priority. Preview 2 also brought better parsing of standard numeric formats as well as runtime and JIT improvements.

Preview 1 introduced Android and iOS as the first two platforms supported in MAUI. Future previews will add MacOS and Windows desktop support. Blazor, which is built on top of MAUI, relies on the UI stack for a native application container and native application container controls.

Copyright © 2021 IDG Communications, Inc.


Click here to get More Details

Leave a Reply

Your email address will not be published. Required fields are marked *