.NET 6 Is Here
Microsoft shipped .NET 6, the culmination of a massive unifying effort to transform the Windows-only, proprietary .NET Framework into one open source, cross-platform development offering for all types of .NET projects.
So .NET Core 2.0 arrived in 2017 as an open source, cross-platform alternative to .NET Framework, and then last year the "Core" moniker was dropped in favor of just .NET 5, .NET 6 and so on going forward.
Microsoft's Themes of .NET
site provides a high-level view of .NET 6:
With the recent additions of machine learnings and WebAssembly (which allows for .NET apps in the browser), the platform can now be used for web, mobile, desktop, games and Internet of Things (IoT) projects.
However, the umbrella "just one .NET going forward" arrival has been late in coming.
The unification effort was supposed to happen with .NET 5 a year ago, but the pandemic slowed things down and tricky development problems plagued some projects.
Also, that unification effort still isn't done, with some lagging components and functionality. For example, mobile is being brought into the fold with .NET MAUI (.NET Multi-platform App UI) -- described as an evolution of Xamarin.Forms because the desktop was added as an app target along with iOS and Android -- but it "slipped the schedule" and "will be released a little later than .NET 6."
For the desktop, the Windows App SDK (formerly called Project Reunion) is meant to alleviate the complexity of Windows app development that was caused by the emergence of two disparate sets of APIs: for the older Win32 platform and the newer Universal Windows Platform (UWP).
Microsoft announced .NET 6 in a gargantuan blog post of more than 16,000 words, in which .NET program manager Richard Lander started out by touting:
- Big performance boosts
- Language improvements with C# 10 and F# 6
- Native support for Apple Silicon (Arm64)
- A new dynamic profile-guided optimization (PGO) system designed to deliver deep optimizations at runtime
- Improved cloud diagnostics with dotnet monitor and OpenTelemetry
New APIs have been added, for:
"Welcome to .NET 6," Lander said. "It is another huge .NET release, with near-equal servings of performance, functionality, usability, and security improvements. We hope you find many improvements that end up making you more efficient and capable in your every-day development and increase performance or reduce the costs of your apps in production. We've already started hearing good things from those among you have already started to use .NET 6."
Along with all the new features and capabilities, one important aspect of .NET 6 is that it's a long-term support (LTS) release, guaranteed to be supported for three years or for one year after the next LTS release is shipped, whichever is longer.
Of course, more than 16,000 words can't be distilled into much of a tl;dr, but Lander provided this bullet-point summary of the huge development effort, reportedly involving some 10,000 git commits from 1,000 or more developers from Microsoft and the community:
- Production stress-tested with Microsoft services, cloud apps run by other companies, and open source projects.
- Supported for three years as the latest long term support (LTS) release.
- Unified platform across browser, cloud, desktop, IoT, and mobile apps, all using the same .NET Libraries and the ability to share code easily.
- Performance is greatly improved across the board and for file I/O in particular, which together result in decreased execution time, latency, and memory use.
- C# 10 offers language improvements such as record structs, implicit using, and new lambda capabilities, while the compiler adds incremental source generators.
F# 6 adds new features including Task based async, pipeline debugging and numerous performance improvements.
- Visual Basic has improvements in the Visual Studio experience and for Windows Forms project open experience.
- Hot Reload enables you to skip rebuilding and restarting your app to view a new change — while your app is running — supported in Visual Studio 2022 and from the .NET CLI, for C# and Visual Basic.
- Cloud diagnostics have been improved with OpenTelemetry and dotnet monitor, which is now supported in production and available with Azure App Service.
- JSON APIs are more capable and have higher performance with a source generator for the serializer.
- Minimal APIs introduced in ASP.NET Core to simplify the getting started experience and improve the performance of HTTP services.
- WebAssembly AOT compilation for Blazor WebAssembly (Wasm) apps, as well as support for runtime relinking and native dependencies.
- HTTP/3 has been added so that ASP.NET Core, HttpClient, and gRPC can all interact with HTTP/3 clients and servers.
- File IO now has support for symbolic links and has greatly improved performance with a re-written-from-scratch
- Security has been improved with support for OpenSSL 3, the ChaCha20Poly1305 encryption scheme, and runtime defense-in-depth mitigations, specifically W^X and CET.
- Single-file apps (extraction-free) can be published for Linux, macOS, and Windows (previously only Linux).
- IL trimming is now more capable and effective, with new warnings and analyzers to ensure correct final results.
- Source generators and analyzers have been added that help you produce better, safer, and higher performance code.
- Source build enables organizations like Red Hat to build .NET from source and offer their own builds to their users.
.NET 6 is supported with Visual Studio 2022, which also shipped today, and Visual Studio 2022 for Mac, but not Visual Studio 2019, Visual Studio for Mac 8 or MSBuild 16. "If you want to use .NET 6, you will need to upgrade to Visual Studio 2022," Lander said. That works because VS 2022 also reached GA today.
In Visual Studio Code, .NET 6 is supported with the C# extension in the VS Code Marketplace.
"Developers have already started upgrading applications to .NET 6 and we've heard great early results in production," Lander said. ".NET 6 is ready for your app."
About the Author
David Ramel is an editor and writer for Converge360.