Microsoft announced .NET 5 a few months ago as the first step in the path to .NET unification. The goal is to have a single set of APIs, languages, and tools that you can utilize across multiple platforms. Today, the firm has unveiled the next stepping stone in this journey, which is .NET 6 Preview 1.
The first preview of .NET 6 brings with it a raft of new features and capabilities. However, first and foremost is that it enables the next bits of .NET unification. Under this plan, while you can use .NET SDK to build mobile apps in Visual Studio and Visual Studio Code, the size of the SDK will actually be smaller because mobile workloads are optional. This capability will be gradually rolled out with .NET 6 releases and will be complete in .NET 7.
With .NET 6, Microsoft is also leaning towards "open planning" so everyone is aware of the direction the company is headed in. This can be viewed in the Blazor-based app here which has multiple filters that allow you to see the plan most relevant to you.
Additionally, .NET 6 comes with a new Multi-platform App UI built on top of Xamarin. It is a toolkit that allows developers to get a consistent view of their apps across various platforms, also allowing them to share code. Microsoft states that the focus during .NET 6 releases will be performance, control themes, and "faster developer experiences". Preview 1 currently includes support for Android and iOS. Windows and macOS will be supported in future releases.
.NET 6 also includes support for developing Blazor desktop apps. This capability is primarily aimed at web developers who want to offer a feature-rich UI in offline desktop apps. Currently, Blazor desktop is being built for .NET apps, but Microsoft has stated that it can be used to build apps in other stacks like Swift as well. As can be ascertained, Blazor is built on top of the Multi-platform App UI, with focus being on providing performance similar to other desktop solutions.
Another project that the .NET is working on goes by the name of "fast inner loop". The aim of this initiative is to enable faster build time and to develop capabilities that allow developers to skip rebuilding altogether, and just integrate code edits in live processes.
With .NET 6, Microsoft is investing more in ARM64 support as well. Performance improvements are a key focus area in Preview 1, along with support for Windows Forms and Windows Presentation Framework (WPF). The development team also plans to add support for Windows Desktop app features in .NET 5 once it has enabled and tested them in .NET 6. With regards to Mac, initial support has been added for Apple Silicon ARM64 chips.
Microsoft also plans to improve containers in .NET 6. Multiple ways to do this include reducing container image size, enhancing the scalability of containers, adding support for Windows process-isolated containers, and optimizing performance, among many others. Based on the current Linux landscape and release strategy, Microsoft has stated that images for .NET 6 will be based on Alpine 3.13, Debian 11, and Ubuntu 20.04. Once the company begins to release new .NET 6 images, this base image version will not change. Debian 10, which has been used as the image in multiple past releases, will be retired.
The .NET command-line interface (CLI) also has a bunch of new experiences thanks to adoption of the System.CommandLine libraries. These include response files and Directives. Furthermore, math APIs and libraries have been added to .NET 6 too. It includes better support for Windows access control lists (ACLs) as well, with improvements to various relevant methods such as Semaphores and Mutex.
The .NET thread pool has been redesigned to enhance portability. It will be the standard for .NET releases going forward, and will allow applications to have access to the shared thread pool, regardless of their runtime.
A major part of .NET 6 Preview 1 is support for Apple Silicon. However, Microsoft has emphasized that this is currently in alpha stage. With this release, both ARM64 and x64 builds for macOS are being released. According to the company, this has been a major effort and as such, it does not plan to release ARM64 versions for earlier releases of .NET. Microsoft has also thanked Apple for all its support in bringing .NET 6 to Apple Silicon.
That said, there are still some issues with the current release on Apple Silicon. Debugging native .NET apps doesn't currently work for any Visual Studio product. Microsoft plans to add support for this in Preview 3. Other known issues include:
- For large stack allocations, the JIT can fail to generate stack clear code since the Apple Silicon page size is 16K.
- Reliability isn’t yet at parity with x64.
- A small number of tests are failing GC Stress testing.
- A small number of tests exhibit intermittent failures.
- CI testing is not enabled (due to machine availability) so test coverage is from manual testing.
- We have not yet designed an experience to use emulated and native .NET versions together on Apple Silicon. If you want to use .NET 6 and .NET 5, for example, on the same machine, you should probably use the .tar.gz. distribution rather that .pkg, so that you can control the version (if any) that is in the path.
- .tar.gz. packages are reported as malicious software.
.NET has not been fully tested on Rosetta 2 emulation, but Microsoft has noted that this is a temporary bridge connected to ARM64 anyway, and will likely not be supported forever by Apple. The Redmond giant plans to support .NET on Macs on these older machines as long as Apple supports them.
As stated, another focus of this release is also performance improvements. As such, .NET 6 Preview 1 brings enhancements to single file apps, single-file signing on macOS, hardware-accelerated structs, and dynamic PGO. It also includes Crossgen2 - a new iteration of the initial Crossgen tool - which allows for easier code generation and cross-generation development. Currently, the SDK defaults to Crossgen, but will be moving to Crossgen2 in future preview releases.
.NET 6 will be officially released in November 2021, similar to how .NET 5.0 was released in the same timeframe last year. You can download .NET 6 by heading to this dedicated webpage and find out more details about it in the extensive blog post here. Microsoft has also stated that .NET 6 Preview 1 was tested on Visual Studio 16.9 Preview 4 and Visual Studio for Mac 8.9, so it is recommended that you use these configurations to test it for yourself.