What’s new in Microsoft .NET 6
.NET 6 Preview 2 features API and library improvements, runtime performance boosts, and early builds of MAUI, the multi-platform UI support based on Xamarin.
Microsoft has published the third 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.
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.
Preview 3 is downloadable from dotnet.microsoft.com. In announcing Preview 3 on April 8, Microsoft noted 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 now is available for ASP.NET Core and Blazor projects using dotnet watch. Hot Reload applies code changes to a running app without restarting it and without losing app state. Code changes that cannot be applied to the running app can be applied by rebuilding and restarting the app. This is the first step in a more comprehensive plan to bring this technology to all .NET developers, supporting desktop development (WPF, WinUI, WinForms), cross-platform client scenarios in .NET MAUI (Multi-platform App UI), and more. Hot Reload will be supported with additional platforms in future previews of .NET 6.
Preview 2 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 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.