Microsoft has published a second release candidate for its upcoming .NET 6 software development platform.
The “go live” release candidate, .NET 6 RC2, was published October 12. RC2 has been tested on, and is supported on, Visual Studio 2022 Preview 5. The new release candidate can be downloaded from dotnet.microsoft.com.
A bulletin on RC2 cites planned .NET 6 capabilities including C# 10, which offers a further evolution of new features such as records and patterns. Also featured for C# 10 are global using directives and file-scoped namespaces, which help developers simplify code and write less boilerplate. C# 10 also supports record structs, similar to C# 9 (class-based) records, but with differences such as record structs being added for completeness so structs can have the same record benefits as classes. Another feature in C# 10, file-scoped namespace declarations, is intended to reduce indentation and line count.
Microsoft expects a production release of .NET 6 to become available in November. Other plans for .NET 6 noted in the October 12 bulletin include:
- The .NET SDK was updated so new features are on an opt-in basis as of RC1, which was released September 14. The following language features are used in new C# project templates: async Main, top-level statements, target-typed new expressions, global using directives, file-scoped namespaces, and nullable reference types.
- Support for MacOS and Windows Arm64 is almost complete. .NET 6 RC2 enables Arm64 + x64 coexistence by installing Arm64 and x64 builds to different locations. Developers need to uninstall all .NET builds and start from scratch on MacOS and Windows Arm64 machines to adopt .NET 6 RC2 or later.
The next generation of Microsoft’s software development platform, .NET 6 will finish the parts of the .NET unification begun in .NET 5. NET 6 is set to deliver improvements for cloud, desktop, and mobile apps. It 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 September 14, Microsoft .NET 6 RC1 was preceded by seven preview releases. RC1 has been tested with and is supported with Visual Studio 2022 Preview 4. In a bulletin on the RC, Microsoft covered foundational features in .NET 6:
- Source build, a scenario and infrastructure being developed with Red Hat that is intended to satisfy packaging rules of commonly used Linux distributions, such as Debian and Fedora. Also, source build is intended to enable .NET Core contributors to build a .NET Core SDK with coordinated changes in multiple repositories. The technology is intended to solve common challenges that developers encounter when trying to build the whole .NET Core SDK from source.
- Profile-guided optimization, which is based on the assumption that code executed as part of a startup often is uniform and that higher level performance can be delivered by leveraging it. PGO can compile startup code at higher quality, reduce binary size, and rearrange application binaries so code used at startup is co-located near the start of the file.
- Dynamic PGO, a mirror image of PGO, integrated with the RyuJIT .NET just-in-time compiler. Performance is improved.
- HTTP/3, previewed in .NET 6, solves functional and performance challenges with previous versions of HTTP.
- CrossGen 2, for ahead-of-time pre-compilation.
- Intel Control Enforcement Technology (CET), available in some new Intel and AMD processors to protect against common types of attacks involving control-flow hijacking.
- W^X, a security mitigation to block attack paths by disallowing memory pages to be writable and executable at the same time.
Prior to RC1, Preview 7, published August 10, polished various features. Preview 7 included:
- Updated .NET SDK templates to use the latest C# features.
- For the libraries, reflection APIs for nullability information were highlighted.
- Generic math, a .NET 7 early preview feature.
- Native memory allocation APIs, also a library feature.
System.Text.Jsonserialization notifications and
System.Text.Jsonproperty ordering. Both are library features.
- For libraries, there are simplified call patterns for cryptographic operations.
Preview 6, unveiled July 14, highlighted capabilities including:
- .NET SDK optional workload improvements.
- TLS support for
- Improved sync-over-async performance.
Capabilities cited in Preview 5, released June 17, included:
- 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
updateverbs, with the
dotnetworkload listcapability telling a developer which workloads have been installed and the
dotnet workload updatefeature 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.
ExtensionsAPIs 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.jsonto 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.
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, unveiled February 17, 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.