📢 .NET 7 Preview 3 adds these enhancements


TECH NEWS DESK:
Microsoft .NET 7 Preview 3 release is now available for developers to try the new functionalities and prepare their apps ahead of final release. - Story published by Kunal Chowdhury on .

If you are looking for .NET 7, Microsoft releases the third preview version of the framework to help you prepare your apps for the next version of .NET. The third preview of .NET 7 includes enhancements to observability, startup times, codegen, GC regions, native AOT compilation, and more. You can grab the build right now to start experimenting with new features.

 

.NET 7 Preview 3 adds these enhancements

 

What's new and improved in .NET 7 Preview 3

Native AOT compilation

When Microsoft released .NET 7 Preview 2, the company announced that the Native AOT support in .NET 7 has been moved out of the experimental status and had been moved into the .NET 7 mainline development. With today's build, Microsoft ships ReadyToRun for client and server scenarios, and Mono AOT for mobile and WASM.

 

What is Native AOT

Ahead-of-time (AOT) compilation refers to an umbrella of technologies which generate code at application build time, instead of run-time. Native AOT brings full native pre-compilation to .NET desktop client and server scenarios. Native AOT is not replacing these existing technologies, rather it’s offering a new set of capabilities that unlocks new form factors.

 

 

Native AOT is similar to .NET’s existing AOT technologies, but it produces only native artifacts. In fact, the Native AOT runtime does not know how to read the .NET assembly file formats – everything is platform-native. The executable file format parsing is fully handled by the underlying operating system, says Jon Douglas, Senior Program Manager (NuGet, Microsoft)

 

 

The main advantage of Native AOT is in startup time, memory usage, accessing to restricted platforms (no JIT allowed), and smaller size on disk. 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.

 

 

Observability

Microsoft .NET 7 continues to evolve support for the cloud-native OpenTelemetry specification. In the .NET 7 Preview 3, Microsoft now adds support for specification updates #988 and #1708. According to the company, this will make the trace state mutable for samplers.

 

    //  ActivityListener Sampling callback
    listener.Sample = (ref ActivityCreationOptions<ActivityContext> activityOptions) =>
    {
        activityOptions = activityOptions with { TraceState = "rojo=00f067aa0ba902b7" };
        return ActivitySamplingResult.AllDataAndRecorded;
    };
  

 

 

Write-Xor-Execute improvements

The major focus of .NET 7 lies in performance improvements. In the latest update, Microsoft reimplemented the precode and call counting stubs (tiered compilation helper stubs) to significantly reduce the number of post-creation modifications of executable code in the runtime. This resulted in 10-15% startup time improvements.

 

This change also resulted in steady-state performance improvements (up to 8%) in some microbenchmarks and some ASPNet Benchmarks even without Write-Xor-Execute enabled.

 

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.