Upgrading to .NET 8: Part 1 - Why Upgrade?

Why should you upgrade to .NET 8?

10 July 2023 by Martin Costello |
10 July 2023 by Martin Costello

Another year, another new major version of .NET is coming - .NET 8, to be specific.

I write that like it's brand new information - it's been coming for a while, what with .NET 8 Preview 1 having being released in Feburary - but it's only recently occured to me to write this blog post series (yes, a series, more on that later).

As annouced a few releases ago, a new major version of .NET is released every November. These alternate between an odd-numbered Short Term Support (STS) release and an even-numbered Long Term Support (LTS) release (see here).

There's a nice graphic here from the .NET website that illustrates how things look today:

A timeline showing the support for .NET 5 in 2020 through to .NET 9 in 2024

That means .NET 8 will be the next LTS release and supercede .NET 6 and also .NET 7 by the end of 2024.

But why should you upgrade to .NET 8? Staying supported and patched is the primary reason, but there's another reason that sounds much more compelling:

"The first thing that you can do to get free performance in your ASP.NET or .NET applications is to upgrade your .NET version."

Damian Edwards

As Damian says in this talk from Microsoft Build 2023, upgrading .NET will often give you free performance improvements in your applications. Just by upgrading your .NET SDK and your Target Framework Moniker (TFM) to the latest version, you can benefit from the performance improvements that have been made in the runtime and libraries since the previous release. You don't even need to adopt any new features or APIs to get the performance improvements - just leave your code as it is.

The caveat to this is that you might need to fix a few breaking changes or new analyser warnings, but these are typically few in number and are usually easy to fix.

This screenshot from the talk illustrates the sort of improvements you can expect to see from a simple upgrade.

A bar chart comparing the requests per second gained by upgrading from .NET Core 3.1 to .NET 5, 6, 7 and 8 preview 4

That makes it seem like a no-brainer to upgrade to me. With lots of people being cost concious these days, penny pinching in the cloud can be a big deal, and small improvements magnified across a large fleet of servers can help make for noticeable savings to your annual $cloud_provider bills.

But why am I writing this as a blog post series, and why is it starting in July and not November?

Testing .NET previews

New releases of .NET are typically in active development for months before they are released, usually with about 10 previews and release candidates available before the final stable "point zero" release. As I've written about before, testing these previews is a great way to help the .NET team.

Have you ever wondered why Microsoft releases preview versions of their products before the final release? Well, it’s so real customers can help ensure their quality before they go live.

I use .NET a lot - for both for my personal projects as well as for my day job, so I'm always keen to try out new functionality and help test things ahead of the release of a new major version. As well as giving back to the wider .NET open source community, it also selfishly helps ensure that my use cases don't get broken too!

At Just Eat Takeaway.com, we have a .NET Guild of which I'm the chair which promotes adoption of best practice to our use of .NET internally. As part of the guild, we have a working group that meets monthly to discuss the latest .NET preview releases and how we can adopt it internally. We regularly test the latest previews on long-lived branches to try them out with our real-world code bases in their infinite diversity.

This is the second year we've run the .NET Early Adopters group and it continues to bear fruit. So far with .NET 8 we've collectively found and reported over a dozen issues to the .NET teams, including a few that we've also fixed ourselves.

Giving timely feedback to the .NET teams helps them to fix issues before the final release, which is a win for everyone. This gives us a high confidence to adopt the latest .NET releases as soon as they are available, rather than wait a period of time for them to "bake in" by letting others step on the rakes for us. If everyone did that, no one would ever upgrade anything!

Meme of three Spider-Men pointing at each other about upgrading .NET

What's in this series?

As the idea for this blog series is recent, it's already running behind. I'm going to try and catch up with a post later this week about our experiences with previews 1 through 5, and then after that there will be at least one post a month to coincide with the release of each new .NET 8 preview until the stable release in November.

Each post will typically contain a summary of our experiences, warts and all, of updating our code bases to the latest preview that are notable. I won't try and cover every single change, but will try and highlight interesting issues and deep drive into the use and adoption of some of the new functionality.

I encourage you to also try out the .NET 8 previews and report any issues you find to the .NET teams. You can find links to download the latest .NET 8 previews from the .NET website.

Read the next part in this series: Part 2 - Automation is our Friend.

Upgrading to .NET 8 Series Links

You can find links to the other posts in this series below.