.NET 7 Release Candidate 2 Is Here — Here’s What’s New!
Tags: csharp, dotnet, news, beginners
Published: 2022-11-03 13:54:23

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](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11#generic-attributes):

> “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](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11#list-patterns):

> _“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](https://learn.microsoft.com/en-us/dotnet/api/system.intptr?view=net-6.0) and [System.UIntPtr](https://learn.microsoft.com/en-us/dotnet/api/system.uintptr?view=net-6.0).

### Raw string literals

[According to Microsoft’s description](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11#raw-string-literals) 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_**](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-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](https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-rc-2/#libraries):

> “…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_](https://devblogs.microsoft.com/dotnet/announcing-rate-limiting-for-dotnet/) _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.

{% embed https://dev.to/bytehide/microsoft-releases-new-net-rate-limiter-in-net-7-and-its-amazing-1bkf %}

---

## 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](https://devblogs.microsoft.com/dotnet/announcing-builtin-container-support-for-the-dotnet-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](https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-rc-2/#how-to-re-enable-reflection-fallback-for-system-text-json-source-generation)**.

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:

```xml
<ItemGroup>
  <RuntimeHostConfigurationOption Include="System.Text.Json.Serialization.EnableSourceGenReflectionFallback" Value="true" />
</ItemGroup>
```

Interested in learning more about this? I recommend you to check the official Microsoft article: **[System.Text.Json source generator fallback](https://learn.microsoft.com/en-us/dotnet/core/compatibility/serialization/7.0/reflection-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?