DEV Community

Cover image for .NET 7 Release Candidate 2 Is Here — Here’s What’s New!
ByteHide
ByteHide

Posted on • Edited on • Originally published at bytehide.com

.NET 7 Release Candidate 2 Is Here — Here’s What’s New!

In case you haven’t heard, the .NET 7 Release Candidate 2 (RC2) was just released by Microsoft, giving us a sneak peek of some of the new additions that will be available in the next major version of the .NET Framework.

Here are the new .NET 7 Release Candidate News!

C# 11

This second Release Candidate starts strong. Right from the start, Microsoft talks about the latest version of C# that will keep .NET 7 company for a couple of years: C# 11.

As it is not news (and if it is for anyone, you will already know it), the development of C# is public and open at all times. Being an open source language, any developer can collaborate and do their bit to improve the language used in the .NET platform.

Therefore, all the new C# 11 features presented during these months of development have been created by developers from all over the world. Among the large number of features presented in C# 11, some of the most noteworthy are:

Generic attributes

As Microsoft describes it:

“You can declare a generic class whose base class is System.Attribute. This feature provides a more convenient syntax for attributes that require a System.Type parameter.”

List patterns

This second feature added in C# 11, Microsoft summarizes it as:

“List patterns extend pattern matching to match sequences of elements in a list or an array. You can match elements using any pattern, including constant, type, property and relational patterns.”

Numeric IntPtr and UIntPtr

This new feature does not present an extensive explanation, now the new additions ( nint and nuint) are aliases of the already existing System.IntPtr and System.UIntPtr.

Raw string literals

According to Microsoft’s description of this new C# 11 feature:

“Raw string literals are a new format for string literals. Raw string literals can contain arbitrary text, including whitespace, new lines, embedded quotes, and other special characters without requiring escape sequences.”

Newlines in string interpolations

The novelty that this feature brings to the new version of C# is that now the text for a string interpolation (that goes inside { }) allows more than one line.

In previous versions this was not possible and with the arrival of C# 11 multiple lines for a string interpolation will be accepted.

In fact there are many, many more, these are just a glance at the top. If you want to discover all the new features of C# 11, I recommend you to check: What’s new in C# 11.


New and improved Libraries

We come to the second point that receives update in this RC2, we are talking about the .NET libraries.

Like practically everything Microsoft does, the libraries are not left behind at any time and that is why today you are reading about them.

These libraries have been updated bringing different performance improvements in the APIs, new features and obviously, new APIs to, as Microsoft says:

“…to assist your daily jobs-to-be-done.”

It is great to know that Microsoft is thinking about making our daily tasks easier as well as adding new features and functionalities :)

One of those libraries (and I dare say the one that has generated the most hype) is the Rate Limiting for .NET.

The .NET Rate Limiting, to sum it up, is in charge of avoiding the overload of requests to an application and has different algorithms (quite interesting) to achieve it.

I don’t feel the need to say more about Rate Limiting for .NET, mainly because if you want to understand how it works (and maybe the Microsoft article wasn’t the most visual), I leave you this article in which I explain (practically) everything you need to know about Rate Limiting for .NET and its different algorithms.


SDK Improvements

This time the .NET SDK is constantly receiving new improvements and functionalities at the level of creation and management of .NET projects.

For this Release Candidate we find built-in container support. This allows you to create containerized versions of an application. The best of all? That it can be done with just dotnet publish.

As this is a topic that can be extended a lot, I leave the official Microsoft article in which it explains everything perfectly: Announcing built-in container support for the .NET SDK


System.Text.Json fallback

Another new feature that is part of this latest Release is the possibility of re-enabling reflection in sources of type System.Text.Json.

What does this mean? Well, to put it in context Microsoft removed the quiet fallback to reflection-based serialization in the first Previews of .NET 7.

It is true that some developers adapted to it but most of them were not convinced by the change. Basically they complained that this new implementation required (practically) impossible modifications to their code and they did not agree.

For this reason Microsoft has added the feature of being able to re-enable the reflection callback in general terms. Now thanks to this, developers will have the 2 reflection options in sources.

This is what the option would look like in case you were wondering:

<ItemGroup>
  <RuntimeHostConfigurationOption Include="System.Text.Json.Serialization.EnableSourceGenReflectionFallback" Value="true" />
</ItemGroup>
Enter fullscreen mode Exit fullscreen mode

Interested in learning more about this? I recommend you to check the official Microsoft article: System.Text.Json source generator fallback

And little more to tell, we are just a few days away from .NET Conf 2022 and the official presentation of .NET 7 and C# 11.

There is nothing left for the long awaited .NET 7 to officially become a reality! Who will follow the .NET Conf 2022? Me for sure! How about you?

Top comments (0)