.NET 8 Preview 5 Features

.NET 8 Preview 5 Features
June 8, 2023
5 minutes read

We’re excited to be here again with a brand new article exploring the latest release of .NET 8 Preview 5. With each new iteration of these previews, Microsoft continues to deliver exciting new advancements to their impressive ecosystem. In this article, we’ll be diving into all the latest features, improvements and optimizations that are included in this fifth release of .NET 8 Preview.

From major performance enhancements to new APIs and tools, there’s certainly a lot to discover.

Let’s take a look at what new features and improvements Microsoft has added in this Preview 5!

Metrics APIs Enhancements

Here begin the first improvements that Microsoft reveals to us. Let’s take a closer look at those improvements.

Dependency Injection (DI) Friendly Metrics APIs

Good news, programmers! The long-awaited IMeterFactory interface is finally here. If you want to create new Meter objects, this is your preview! Now you can finally do it with IMeterFactory.

Let’s check Microsoft Example in this case:

Loading code snippet...

Let’s check the next code example:

Loading code snippet...

Instruments and Meters (now with Tags!)

That’s right! Now you can create Meters and Instruments with attached key-value pair tags 🏷️. For those who don’t know, this feature that has been introduced in Preview 5, helps to keep a difference between the aggregate values taking into account the tags.

Let’s check Microsoft Example in this case:

Loading code snippet...

SDK Updates

The .NET SDK comes packed with some really cool updates. Let’s explore what’s new.

No more juggling individual PackageReferences! The .NET SDK now seamlessly integrates Source Link, providing a smooth IDE experience for effortless examination of SourceLinked NuGet Packages 🌟.

Discover New .NET Libraries Analyzers

Remember those invaluable analyzers and code fixers that help us utilize .NET Library APIs effectively? The SDK now features even more of them! Plus, a big shout-out to the awesome community members who contributed to many of these newly added analyzers 🎉.

Framework-Dependent Deployments Take the Lead in .NET 8 Preview 5

With .NET 8 Preview 5, framework-dependent deployments (FDD) are now the default choice. But don’t worry! If you require a self-contained deployment (SCD), options are still at your disposal. Head over to the announcement to learn how to opt-in.

Docker enthusiasts, Get Ready for Exciting Updates!

For all you Docker fanatics, we have some fantastic news in store.

Welcome to the World of Alpine ASP.NET Docker Composite Images

The new Alpine-based composite image has landed, offering a cutting-edge and enhanced version of the ready-to-run compilation.

Termed as “composite,” this approach combines multiple MSIL assemblies into a single, impressive R2R binary. The result? Faster startup times, minimal JIT duration, and smaller R2R image sizes. How cool is that?!

Keep in mind, though, composite images come with tighter version coupling. We’re kicking off with Alpine due to its compact size, but watch this space as we may extend to other image types, like distroless, in the future.

Runtime and Codegen Updates

There’s fabulous news for Dynamic Profile Guided Optimization (PGO) fans: it’s now enabled by default, potentially improving performance by an astounding 5% to 500%! If you have questions on Dynamic PGO, just use <TieredPGO>false</TieredPGO> in your .csproj file to opt-out.

Sure thing! Here’s a revised version with “they” and “Microsoft”:

Turbocharge your code with Dynamic Profile Guided Optimization (PGO)

Hey there, did you know that Dynamic PGO is now enabled by default in C#? Yup, no more fiddling with special settings! This beauty has the potential to improve performance from 5% to a whopping 500%! Of course, the expected bump is around 15%, but that’s still fantastic, right?

Testing showed that 23% of around 4600 tests improved by 20% or more. Giants like Akka.Net, Azure Active Directory Gateway, and Microsoft Graph are already harnessing its power! Got feedback? Go ahead, Microsoft can’t wait to hear it.

Oh, and if you need to opt-out, just add <TieredPGO>false</TieredPGO> to your .csproj, runtime config, or environment.

Elevate your GC-Type game with Enhanced ThreadStatic Field Access

Fantastic update! Optimizations are now available for primitive and reference types in field accesses tagged with ThreadStaticLocal!

Say hello to Arm64 Peephole Optimizations

Arm64 optimizations, anyone? You bet! Starting with Preview 5, embrace these shiny peephole optimizations.

The awesome dev team has replaced str pairs with stp in PR#85032 and switched ldr/str pairs for ldp/stp inside prologs via PR#85657. How wicked is that?

Enhanced Productivity in Visual Studio Code

The C# Dev Kit plugin for Visual Studio Code is here, devs and it’s time to crank up your efficiency. The Test Explorer now has the ability to run tests and provides better code management, AI-assisted suggestions and more!

And there you go, fellow C# enthusiasts! .NET 8 Preview 5 rolls out with even more enticing features and optimizations to elevate your coding experience. Are you as thrilled as we are to explore the latest additions to the .NET ecosystem?

Remember, the clock is ticking! Don’t miss out on getting ahead with the ever-evolving world of .NET 8. Share your thoughts on these enhancements and how they would impact your projects. So, why wait? Put your coding gears on and dive into .NET 8 Preview 5 right now. Happy coding!

You May Also Like

Optional Parameters in C#: What You Need to Know

Optional Parameters in C#: What You Need to Know

Programming in C# often requires flexibility and simplicity ...

What is Lock Keyword in C#? Main Usages

What is Lock Keyword in C#? Main Usages

IndexUnderstanding the C# Lock Keyword Can’t tell a lock fro...

Enumerate in C#: Detailed Explanation

Enumerate in C#: Detailed Explanation

Desperate to decode the mystery that is enumeration in C#? I...

Creating a JSON Class in C#: Detailed Guide

Creating a JSON Class in C#: Detailed Guide

In the world of application development, manipulation of dat...

Static Class in C#: How to Use It?

Static Class in C#: How to Use It?

Hello there, future C# aficionado! It’s time to roll down th...

DateTime Formatting in C#: Dev Guide

DateTime Formatting in C#: Dev Guide

Have you ever gotten frustrated handling dates and times in ...

Leave a reply

Loading comment form...