Microsoft does not stop! For months now we have seen updates and news from the .NET development team and they have just released the third preview of .NET 7. This final version is planned for release in November this year, but until then let’s talk about the new features and performance improvements it will bring!
Faster, Lighter Apps (Native AOT)
After a while, the experimental Native AOT project has become the main focus of Microsoft’s development. As many of us have been asking for a long time, Microsoft has decided to bring us a couple of updates to Native AOT.
For those who don’t know what Native AOT is, Ahead-of-time (simply AOT) generates code at compile-time instead of run-time.
At this time, Microsoft already offers ReadyToRun (client/server applications) and Mono AOT (mobile and WASM applications) for this purpose. In addition, Microsoft adds that Native AOT does not replace Mono AOT or WASM.
- Startup time
- Memory usage
- Disk size
- Access to restricted platforms
Microsoft explains how Native AOT works:
“Applications start running the moment the operating system pages in them into memory. The data structures are optimized for running AOT generated code, not for compiling new code at runtime. This is similar to how languages like Go, Swift, and Rust compile. Native AOT is best suited for environments where startup time matters the most.”
In addition, they have revealed a benchmark comparing NativeAOT against ReadyToRun, in which the compile time is up to 73% faster and almost half as light:
Apart from Native AOT, we have many more new features such as the Managed Extensibility Framework update: Now the new APIs will allow you to add a single object instance to the
You can check the original proposal: Inject existing object into MEF2
Microsoft also brings us improvements in support for the cloud-native specification (OpenTelemetry). Although it is still under development in .NET 7, it has been added Allow samplers to modify tracestate and Samplers should be allowed to modify tracestate. Here we can see the Microsoft example:
Reduced start-up time (Write-Xor-Execute)
As we have already seen at the beginning, Microsoft has decided to focus mainly on performance improvements and this one is no exception. Now with Reimplement stubs to improve performance we have seen an improvement in startup time that, according to Microsoft, is up to 10–15%.
This is mainly due to a large reduction in the number of modifications after code creation at runtime.
Generating X.500 names more robustly
Also in this preview, Microsoft has focused on cryptographic security. That is why building an
X500DistinguishedName is now much easier and more secure.
The main problem with this is that the quote, comma or any other element influences the parser. Microsoft’s solution has been to add the
X500DistinguishedName class. There would be no problem since each method can only operate on a single RDN (Relative Distinguished Name).
Let’s look at the Microsoft example:
These are the main new features of the new .NET 7 preview 3. If you want to see in depth everything that brings in its latest version, I recommend you the original source: Announcing .NET 7 Preview 3.