28
.NET 6: The MOST promising FEATURES 🔥
Microsoft is putting the batteries and already presents .NET 6 Preview 5. According to what they tell us, they are already in the second half of the .NET 6 version and they are beginning to teach new features that promise a lot. 🤗
What is .NET in general, is a Microsoft platform to develop Software, covering many operating systems such as Windows, iOS, Linux, Android … The main idea of .NET is to be able to develop applications independent of the physical architecture or the operating system in the one that was going to be executed.
Its main advantages are:
- Decreased development time
- Use of predesigned functionalities
- Reduction of development and maintenance cost
- Simplification of maintenance
Okay, I understand. And what is .NET 6? 🤔
.NET 6 is the new version of .NET (currently .NET 5) that Microsoft promises to release on November 9 of this year. It brings many improvements and new features compared to .NET 5.
If we speak in general, we can speak from .NET MAUI, through the new implementation of the 64-bit architecture, to Visual Studio 2022 and its function more... 😎 But we are going to explain the most important ones and the ones you should know.
Package validation tools will allow NuGet library developers to validate that their packages are consistent and well-formed.
Its main characteristics are:
- Validate that there are no important changes in the versions
- Validate that the package has the same set of public APIs for all specific runtime implementations.
- Determine applicability gaps in the target framework or in the execution time.
Microsoft reports that it has added new workload commands in .NET 6 to improve administration:
-
dotnet workload search
List the workloads available to install. -
dotnet workload unistall
Removes the specified workload if you no longer need a workload. It is also a good option to save space. -
dotnet workload repair
Reinstall all previously installed workloads.
Here we can see how to enable the pre-compilation with Crossgen2 from the MSBuild properties:
<!-- Enable pre-compiling native code (in ready-to-run format) with crossgen2 -->
<PublishReadyToRun>true</PublishReadyToRun>
<!-- Enable generating a composite R2R image -->
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
Already with .NET 6 you can set a default font for an Application.SetDefaultFont
application. Also the pattern it uses is similar to setting high dpi or visual styles. An example:
class Program
{
\[STAThread\]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);\+
Application.SetDefaultFont(new Font(new FontFamily("Microsoft Sans Serif"), 8f));Application.Run(new Form1());
}
}
Here are 2 examples after you set the default font.
Microsoft Sans Serif, 8pt:
Chiller, 12pt:
BigIntegers parsing of decimal and hexadecimal strings has been improved. In the following photo you can see improvements of up to 89%:
The .NET crypto APIs support the use of OpenSSL 3 as the preferred native crypto provider on Linux. .NET 6 will use OpenSSL 3 if available. Otherwise, it will use OpenSSL 1.x.
The graph below shows part of an iOS startup CPU sampling session seen in SpeedScope:
The following image shows the Android CPU sampling seen in PerfView:
This .NET 6 Preview 5 is perhaps the biggest so far of all the ones that have been released in terms of quantity and quality of features. Right now you can try .NET 6 by downloading it from the Official Web of .NET 6.
As Microsoft says…
The future has arrived
With all the tools already announced and all that remain to be shown and released, development will become a much easier, more optimized and more productive task, highly improving the developer experience in their current and future projects.
From Dotnetsafer we would like to know your opinion. Sound good features? Anything you would like them to take out? Leave it in the comments so we can talk about it. 😊
28