.NET 6 Release – Everything You Need to Know
Table of contents
After spending more than a year in development, Microsoft finally announced .NET 6 to the world on November 8th, 2021. The rollout is Microsoft’s biggest yet in the software development software domain. It is the last part of the .NET unification program, envisioned by Microsoft at the time of .NET 5. It unifies the SDK, base libraries, and runtime across various app platforms.
Microsoft also promises massive gains in performance, native support for Apple Silicon (ARM 64) and improvements for ARM 64, with .NET 6, calling it the fastest .NET version yet. It can be downloaded for Windows, macOS, and Linux from dotnet.microsfot.com. So, here’s a look at some of the monumental changes and features that the .NET 6 ecosystem offers to developers and how it benefits them.
Unified Platform
Developers now have a single view for different platforms with .NET 6. Cloud-based, desktop, web, mobile, and IoT apps all now have a unified and extended platform with .NET 6. The new capabilities and improvements with .NET 6 make it possible for developers to reuse their codes across various platforms easily.
Additionally, the source code behaves the same way and provides the same benefits whether it is being run on the cloud, desktop, or on a mobile device. This helps reduce the time and stress associated with software development for multiple platforms. Moreover, the capabilities of the .NET 6 development continue to increase with time, with machine learning and WebAssembly being the latest additions to the list.
Improved Performance
Microsoft has been putting a lot of emphasis on improved performance brought about by .NET 6. Here’s a quick glance at various performance improvements brought by .NET 6.
FileStream
There are massive input-output (IO) improvements possible due to System.IO.FileStream being completely written by Microsoft engineers with .NET 6. Developers can see massive performance and reliability improvements on Windows as the implementation no longer uses blocking APIs with .NET 6. As per testing, there is about 4x speed improvement and a 12,000x allocation drop on Windows. Furthermore, performance improvements with FileStream can be seen across all platforms, significantly helping developers.
Profile-guided Optimization
Profile-guided optimization (PGO) is based on the concept that if the code executed at the start is uniform, it leads to enhanced performance. There are two types of PGO enabled in .NET 6 – dynamic PGO and static PGO. While static PGO is an old feature with .NET, Dynamic PGO is introduced with .NET 6. Let’s have a look at each in detail.
- Dynamic PGO
The major distinguishing feature between static PGO and Dynamic PGO is that Dynamic PGO is automatic. Unlike Static PGO, it doesn’t require special tools and separate training. Dynamic PGO remarkably improves steady-state performance. For instance, it gives a 26% improvement in requests per second for the TechEmpower JSON “MVC” suite with no code changes.
- Static PGO
It uses the data collected from earlier runs to optimize future instances. Currently, it is used to optimize assemblies that ship with Ready to Run (R2R). The biggest benefit of static PGO is that there is a runtime benefit with no runtime cost.
Hot Reload
This feature has been available for several years with JavaScript frameworks. It has finally made its way to .NET with .NET 6. Hot Reload enables the developer to modify the source code. The modifications are applied instantaneously. This can help improve productivity as developers can create new and improved iterations of the software quickly and easily.
This is possible as only the edited code gets reloaded. This feature, therefore, saves the time wasted in-app rebuilds and restarts. It is available through the dotnet watch tool and Visual Studio 2022. It works with a large number of .NET apps, C#, Visual Basic, and C++ source code.
Ready-to-run Code
Crossgen 2 has replaced Crossgen in .NET 6. It is developed and included in .NET 6 for two main reasons;
- Make cross-gen development more efficient
- Enable capabilities that are currently not possible with Crossgen
The tool improves publishing by precompiling the intermediate language. A single machine can be used to generate native codes for all target platforms. However, to test the code, a developer will need the appropriate hardware and software.
Build-time Improvements
One of the biggest and best changes in .NET 6 from a developer’s POV is build-time improvements. Developers can now code in a fraction of the time required previously due to the new language features introduced with .NET 6 and C# 10. Similarly, the Razor compiler has received a massive speed improvement. It can now use Roslyn source generators. Some benchmarks released by Microsoft show that the build times are being reduced by about fifty per cent. This will prove beneficial for large-scale projects, which generally consume a considerable amount of time.
.NET MAUI
.NET Multi-platform App User Interface (MAUI) is one of the most exciting features added in .NET 6. It is built on top of Xamarin. It enables developers to build apps for multiple operating systems, with just a single source code. It handles the abstractions to native-platform APIs in a platform-neutral way. While MAUI seems to be a winner right from the start, a wait-and-watch approach needs to be adopted, looking at Microsoft’s UI reception history.
C# 10 Language update
.NET 6 brings a ton of new features to C# 10 languages. It continues down the road of language simplification, a vision started with C#9. Some of the features added to C#10 include:
- Record structs
- Enhanced #line pragma
- Extended property patterns
- Global using directives
- Improvement of structure types
Additionally, most of the .NET 6 project templates are based on C# 10 changes. The new templates are much simpler and cleaner than before, making it easier for new developers to write programs.
Certified engineers
Convenient rates
Fast start
Profitable conditions
Agreement with
EU company
English and German
speaking engineers
Improved Security
Security has been an important aspect in .NET 6. It adds preview support for two key attack types, Control-flow Enforcement Technology (CET) and Write Exclusive Execute (W^X). Both these technologies protect against hijacking by cybercriminals.
While W^X is fully supported on all operating systems, it is enabled by default only on macOS ARM 64. Developers will need to enable it manually on other operating systems. Similarly, CET needs to be opted-in manually by developers in all environments. Microsoft expects both of these technologies to be enabled by default for all operating systems in .NET 7.
HTTP/3
HTTP/3 is the latest version of HTTP and brings along a host of new features and performance improvements with .NET 6. A new connection protocol, called QUIC (Quick UDP Internet Connections), is what enables these new improvements. It has an integrated TLS that enables it to establish connections more quickly, which are independent of IP addresses.
This enables mobile users to easily switch between mobile data and WiFi without a loss in connection or data speed. However, HTTP/3 is not supported by .NET 6 on macOS. This is due to the lack of a TLS API.
ARM 64 Support
ARM is everywhere today, from laptops to desktops to smartphones, and is most likely the go-to choice in the future. .NET 6 provides support for both macOS ARM 64 and Windows ARM 64, making it easier for developers to code for apps on major platforms.
Microsoft has partnered with Arm Holdings and Apple, to ensure that .NET 6 is implemented and optimized on Apple as well as Microsoft platforms, ensuring developers don’t face any issues from the app development stage itself. However, it is not supported on Linux yet.
Conclusion
.NET 6 seems to be the biggest and most exciting update to the .NET ecosystem. This blog has covered the most noteworthy features of .NET 6 and the benefits they bring to developers. However, .NET 6 brings much more than that. Microsoft has said, “ It’s inspiring to see the new features in .NET 6 that will lay the foundation for what’s coming next. These are big-bet features that will push the platform forward in both obvious and non-obvious ways.” However, only time will tell how successful, or unsuccessful .NET 6 will turn out to be in the developer community.
That being said, one thing is for sure, with the development and release of .NET 6. Steve Ballmer’s iconic “Developers, Developers, Developers” mantra has manifested into a reality, with the software giant taking the right steps to simplify the developers’ workload. As a developer, which .NET 6 feature has got you the most excited? Do let us know.