Pre-loader

Upgrading .NET Core 2.1 to 3.1

09 September 2021

.Net Core

I wanted to talk about a recent upgrade I’ve undertaken. Upgrading various .NET Core 2.1 applications to .NET Core 3.1. There might be a couple of serious reasons why you may consider upgrading if you are a cloud engineer. I’ll talk about some neat features developers might not have thought about that are in .NET Core 3.1.

.NET Core 3.1 might seem old school as .NET 5 has been around since November 2020. However you need to consider that .NET Core 3.1 is on long term support which factors into your total for long term effort. You need to consider time, cost, size, complexity, and business value. It doesn’t surprise me that many projects aren’t migrated to a newer version if they can get away with it. See here for the .NET Core and .NET 5 release lifecycles.

The end of life for .NET 2.1 has passed (August 21st 2021) and has had knock on effects for some cloud technologies. AWS lambda functions by October 20th 2021 will not allow new deployments for .NET Core 2.1 applications. Microsoft has migrated Docker Images from docker hub to its own servers, which will have had some minor dev and dev ops effort to transfer over.

There are many new features in .NET Core 3.0 and 3.1 respectively

 

One of my favourite features is the New JSON serialisation. I could probably do an article on this by itself, but the snapshot is System.Text.Json is now used throughout .NET Core by default, superseding Newtonsoft.Json. Top tip, System.Text.Json is about 50% faster than Newtonsoft.Json. If you are doing a lot of serialisation for large work loads, I’m thinking about when you are transferring data between your Microservices, you are going to realise some great gains from swapping out the good old faithful Newtonsoft.Json library for System.Text.Json.

The undocumented passive general performance gains. From doing a dig online there are several articles from developers reporting a 10% increase in performance. For larger systems this is not exactly small fry. Whether you need fewer virtual machines or if you are running serverless functions (AWS lambda or Azure functions), those cost savings over the year are going to help.