DEV Community

Cover image for .NET 6: The MOST promising FEATURES 🔥
ByteHide
ByteHide

Posted on • Edited on • Originally published at bytehide.com

.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? What is it for?

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.


What are .NET 6 new features?

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.


NuGet package validation

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.

Workload Enhancements in the .NET SDK

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.

Crossgen2

Crossgen allows IL precompiling into native code as a publishing step. Pre-compiling is primarily beneficial to improve startup. Crossgen2 is a scratch implementation that is already proving to be a superior platform for code generation innovation.

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>
Enter fullscreen mode Exit fullscreen mode

Windows Forms: The default font

Already with .NET 6 you can set a default font for an Application.SetDefaultFontapplication. 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());  
}  
}
Enter fullscreen mode Exit fullscreen mode

Here are 2 examples after you set the default font.

Microsoft Sans Serif, 8pt:

Image description

Chiller, 12pt:

Image description


Performance increase in the BigInteger library

BigIntegers parsing of decimal and hexadecimal strings has been improved. In the following photo you can see improvements of up to 89%:

Image description


SSL 3 support

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.


IOS CPU Sampling (SpeedScope)

The graph below shows part of an iOS startup CPU sampling session seen in SpeedScope:

Image description


Android CPU Sampling (PerfView)

The following image shows the Android CPU sampling seen in PerfView:

Image description


.NET 6 Conclusion

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.

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.😊

Top comments (2)

Collapse
 
stevenode profile image
steveNode

Biggest change for me is the hot reaload, I'm very much enjoying the hot reaload in blazor and WPF

Collapse
 
bytehide profile image
ByteHide

That's what we like the most!

Honestly, it was hard to re-compile and run every time you changed something, I think our productivity is going to increase a lot 🚀🚀