.NET 6 Preview 4 features Hot Reload improvements, RyuJIT compiler and 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 4 is downloadable from dotnet.microsoft.com. Announced May 25 and ready for real world testing, Preview 4 establishes 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.
System.Text.Jsonnow 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
FileStreamperformance on Windows.
LoggerMessageAttributetype 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
unsafeAPI, 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,
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.