It looks like that lockdown was not hard for Microsoft. This year, the Plenty’s Horn opened and we had a shower with new software products — the long-awaited Windows 11, and the new Visual Studio 22, and, of course, .NET 6.0. This is good news in these bad times.
Let's talk about the new product, which is the most interesting for developers — .NET 6.0. Hardly developers ported their projects to NET 5.0 when a new version was released. I will go forward to tell the obvious truth that version 6 is not something fundamentally new - it is the “finished-off” fifth version. Most changes include modified or revised solutions from last year's release, but the sixth version received LTS (Long Time Support) status — it became a version with long-term support. From now on, this will be the case for all even versions.
As you remember, starting with .NET 5.0 Microsoft decided to merge all its frameworks into one. This was done to get rid of the "heterogeneity". That is, we came to the original concept of the .NET Framework, but now it is not a monolith, but looks like this.
There are a lot of changes and additions in NET 6.0. To make this article more than just a tedious treatise, I will briefly review the main, most interesting ones:
The updated Crossgen utility now had a second version. The old pre-compilation technology was, let’s have it straight, imperfect, and only enabled generating native code for the platform where the old crossgen utility was running. Now it enables running the JIT compiler regardless of the platform using different strategies and optimizations depending on the situation.
It is a compiler optimization to prioritize the compilation of application parts. The point is that not all parts of the program are used during execution or are used extremely rarely. For example, some exotic else if branches. We can improve application performance if we point to frequently executed areas. Now you can turn on the analyzer, which, during the execution, will determine frequently and rarely used areas, and also generate an optimization profile. There are three optimization scenarios:
You will be especially happy with this feature. Finally, debugging applications got really simple! Now you can start debugging once and edit the code in real time. You will understand how this works if you have ever debugged javascript in your .NET Core projects.
You probably remember something like "Edit and Continue". We had the opportunity to change the code at runtime, but it was not very convenient. You had to set breakpoints and pause the application. The breakpoint had to be set before the moment to be debugged. Edit possibilities were also very limited.
https://docs.microsoft.com/en-us/visualstudio/debugger/supported-code-changes-csharp?view=vs-2019
Now we can fix the code right at runtime while debugging. Then save the changes and see them in real time. This greatly speeds up the debugging process, especially if you know what and where to fix and want to see the result immediately without restarting the debugger. And yes, it now works in VS Code as well. The list of available changes is short and is available here.
As part of globalization or combining all the frameworks, Microsoft is adding support for Xamarin. Now we have developments for macOS, iOS, and Android in VisualStudio. However, this will not work in the standard SDK. You will need to install the optional Optional SDK Workloads. In fact, development is becoming more and more convenient. Creating a project on Android is a matter of a team:
dotnet new android
They decided to abandon the name Xamarin and now presented the Multi-platform App UI or MAUI.
It is worth talking about an interesting tool Minimal API. This framework enables to make do with minimal code for creating and accessing web methods. You don't need to create the MVC binding, customize the controller and method headers to build up the routing. Moreover, you won’t need Setup.cs either. All you need is Program.cs where you can immediately develop web methods with routing.
app.MapGet("/", (Func<string>)(() => "Hello World!"));
The unnamed function will return "Hello World!" for any query. This is exactly what is needed for microservices or prototyping.
Microsoft has published a list of all supported operating systems, namely:
ARM64 support was implemented in NET 5 for Windows. In the sixth version, it was expanded to the ARM64 Apple processors.
While Blazor is a framework for web-based applications, Microsoft decided to break the mold and enable developing desktop applications. Blazor has probably proven its worth.
Razor compiler was merged to Roslyn Source Generators, which significantly accelerated the build. Roslyn Source Generators was introduced in NET 5 and made a stir with its possibility to generate C # code on the fly while developing.
Developers also worked on our favorite LINQ. With every .NET release, they add something new to this language (especially in .NET 5) and this release was no exception. LINQ has been made faster over the past few years and the code duplication was reduced. Here is a small list of useful features:
Well, how we could forget modifications to the System.Text.JSON library. The main changes were made to the serializer. Namely:
The HTTP communications protocol has been around for ages. Everyone knows that it is based on another protocol, TCP, which has been around for even longer. Yes, the rapid development of the Internet has put http in a difficult position - it looks like a weak link against the growth of network bandwidth. Finally, we got the third version of this wonderful protocol. It did not eliminate the problems but significantly reduced their degree.
The new QUIC protocol, which replaced TCP, is faster if packages are lost. It is faster during the connection setup. It allows for parallel data transmission. Moreover, it is inherently secure thanks to encrypted queries.
A new class has appeared — PriorityQueue <TElement, TPriority>. It allows you to set the priority on each added item and creates a priority queue. These items are removed starting with the lowest priority.
Developers also worked with the date. Some of the most interesting modifications:
We can write a separate article about the new features of version 10. I will not even mention the most interesting here. You can check out this list of changes.
Let's sum up - what does .NET 6 offer:
Of course, we tested our products for compatibility with the new framework. FastReport operates on .NET 6 just as well as on version 5.
We can say that there is a right vector to consolidate platforms, languages, and technologies. Yes, the younger generation has the fewer technical knowledge, but we no longer need them. Just like an automatic gearbox displaces a mechanical one. People just should drive and not think about gears and engine rpm. Like many modern developers do not want to get into the technical buzzwords of certain processes. Now they can enjoy the creative aspect of software development.