What’s new in .NET 6 Preview 6? Things you need to know
On July 14th, 2021, Microsoft announced the release of .NET 6 Preview 6, achieving another milestone for making a developer’s journey easier and decorated with better functionality. They also announced that the next release, i.e., Preview 7, will be much bigger than Preview 6.
But that does not mean that we can ignore what’s added and improved in this release. After the Preview 7 release, Microsoft has planned two .NET 6 Release Candidates followed by the final GA release. So, you can expect to see a few changes in the way of doing thighs with .NET 6. Until then, let’s check out the changes in .NET 6 Preview 6, starting with an introduction of the same for better understanding.
.NET 6.0 What’s New?
Continuous development according to the dynamics of the tech industry and its applications is essential for any technology to survive. We are witnessing this with Microsoft .NET, and it has been great to the tech giant addressing the changing developmental needs.
Earlier, we had published the changes made in Microsoft .NET 6 Preview 1. Here’s a recap of the changes made then:
- A .NET developer can now get a single app view for different platforms. The support for this functionality was added for macOS, Android, and iOS development;
- The Blazor technology was combined with web and native UI, expanding the .NET programming circle;
- There were improvements in the ARM 64 support.
In addition to the .NET 6 Preview 1 improvements, the other 4 Preview releases added a load of other features to the .NET 6 development environment. These are;
- Improvements in hot reload making editing the source code and initiating updates without needing to pause the application;
- Enhancements to the API via LINQ enhancements;
- Improvements to the RyuJIT compiler;
- Added a new unsafe API (CollectionsMarshal.GetValueRef) to speed up the updates in struct values;
- API and Library improvements were introduced in Preview 2;
- Improvements in the inner loop performance;
- Improvements in the code generation abilities within RyuJIT making the entire process more efficient and faster;
- There was an increase in the Interface casting performance of 22% (from 16% to 38%);
- Hot Reload now works with different types of applications, including Windows Forms, WinUI, ASP.NET, Console Apps, etc.
All these improvements set the stage for releasing the .NET 6 Preview 6. Let’s understand the new changes and improvements in .NET 6 Preview 6 leading to a beneficial change in the .NET development environment.
What’s New in .NET 6 Preview 6?
Preview 6 has brought changes for some specific components of .NET 6 and to the general elements. In the former, you will observe additions and improvements to ASP.NET Core, EF Core, and .NET MAUI.
- X64 Emulation Update. After adding support for Apple Silicon (macOS) and Arm64 (Windows), the Preview 6 release comes with added support for X64 simulation for both operating systems. To make this work, the developers need to have Side-by-Side capable installers and First-class architecture targeting with .NET CLI. However, the Side-by-Side capable installers are yet to become available in .NET 6. So until then, the developers need to work with X64 Builds or Arm64.
- Improvements to the .NET SDK Optional Workload Segment. Microsoft has added three new workload commands that will improve discovery and management on the .NET 6 development environment. These are:
- Dotnet workload search: This command will list all the workloads available for installation.
- Dotnet workload uninstall: With this command, the developers can remove or uninstall a specified workload from the environment when it is not required. The purpose is to help developers save some space.
- Dotnet workload repair: If a previously installed workload is required again, in case it has been removed, this command can help reinstall it quickly.
These commands must be considered together with the three other dotnet workload commands released earlier. They were:
- Dotnet workload install
- Dotnet workload list
- Dotnet workload update
The dotnet workload commands have dual functions. They help with creating demands for working with .NET projects, making it easier to implement the way of doing things. Second, these commands help run the .NET applications by letting the developers specify a path for the same.
- Crossgen 2 Tool replaces Crossgen. The Crossgen 2 tool has been added to Preview 6 improving, replacing the existing crossgen tool. This means that Microsoft has removed crossgen from the development environment. The purpose of this tool is to pre-compile IL (Intermediate Language) to the native code, improving the publishing. With crossgen 2 added to .NET 6 Preview 6, the developers get access to a superior coding platform for code generation.
- Enhanced sync-over-async performance. Sync-over-async is an antipattern used for blocking wait on the async method. What this means is that you need to wait for the results asynchronously. Waiting means wasting thread, which leads to unresponsiveness. The earlier updates in .NET 6 programming interface included sync-over-async blocking work. But with the new Preview 6, this functionality has been further improved this function by increasing the rate of thread injection. Slower thread injection led to delays in other aspects of work queued. In Preview 6, sync-over-async is the only type of blocking work operation within the thread pool worker threads.
- Added TLS Support. In .NET 6 Preview 6, developers will find TLS (Transport Layer Security) for System.DirectoryServices.Protocols. Before Preview 6, it was added only for Windows, but this new release has added support for Linux and macOS. With the TLS support for macOS and Linux systems, the .NET developers can get secure communication connection with the LDAP servers.
- Changes with CodeGen. Microsoft has bought a series of changes on the CodeGen Changelog. These are implemented in the form of Dynamic PGO and LSRA. Let’s go through them:
- Dynamic PGO: Here, a .NET developer can add an option for choosing a guarded devirt class randomly.
- LSRA: There is the refactoring of LSRA Heuristics selection. With this, the developers get a new mode in DEBUG. COMPlus is the new mode that lets developers set heuristic ordering via LsraOrdering.Along with this, it also allows tuning the heuristics for registration to a selected optimal register candidate.
These were some of the general changes and improvements in the .NET development after the Preview 6 release. Now onto some other changes and improvements which are connected to a specific technology or component.
Other New Functions of the .NET 6.0 Preview 6
As discussed above, .NET 6 Preview 6 has additional functions for ASP.NET Core, EF Core, and .NET MAUI. Here are some of the most important improvements;
- ASP.NET Core
- Blazor Accessibility: A series of changes have been implemented here, including the addition of “role=alert” attributes. These attributes link to messages and need to be announced during page navigation. Counter component has been added to “role=status” to provide an accurate, current count and update the same. Also, title has been added to the NavBar toggle button to announce the purpose clearly.
- Optional Parameters. The View Component tag helpers have support for optional parameters. This removes the need to explicitly specify a value for the parameter you want to add in the form of a tag helper attribute.
Here’s an example of how it can be implemented. Suppose the View Component is written as below:
In this case, the .NET developer can invoke the same in the form of a tag helper while specifying a value for showSomething parameter.
- Entity Framework (EF) Core
With the new .NET 6 Preview 6 release, the developers will observe the gap between EF Core and EF6 closing. Some of the additions that will make this possible are:
- Active support is provided for 64-bit identity seed values
- Preview 6 has added support for new BCL DateOnly and TimeOnly structs for SQLite.
- Pre-convention model configuration: This one is an important update because earlier, there were a few problems reported when .NET developers tried to exclude an entity type and initiate a revert function to initiate the same./li>The new release improved the model building leading to efficient recognition of entity type.
- .NET MAUI
MAUI stands for Multi-Platform App UI, and .NET 6 Preview 6 has added several new capabilities with respect to UI development. These include new gestures, modal pages, native-like alerts, flex layouts, view clipping, and much more.
- Workload Installation: Within the .NET development environment, SDK workloads unique to a developer scenario have been introduced, which works over the existing .NET SDK installed on the system. These additions are a part of .NET unification and workloads added include maui, maui-mobile, and maui-desktop.
Even though Microsoft says that .NET 6 Preview 6 is a small release, we can see that there are plenty of innovative additions. It is clear that Microsoft continuously monitors the .NET development environment and keeps track of the issues faced by .NET developers. As a result, we can see several improvements and additions in response to the concerns and development-based issues faced.