DEV Community

Cover image for .NET Core 2.1 highlights: standing on the shoulders of giants
Samuele Resca
Samuele Resca

Posted on

.NET Core 2.1 highlights: standing on the shoulders of giants

Originally posted on

Since two years after the 1.0 version, .NET Core has gained a lot of popularity in the software engineering world. The following chart came from the Stack overflow survey 2018:

Stack overflow survey 2018: .NET Core

Nowadays, .NET Core is in the top 5 of the most popular Frameworks, Libraries, and Tools. The metaphor of dwarfs standing on the shoulders of giants expresses the meaning of discovering truth by building on previous discoveries and experience. The point is that the .NET team has learnt from their previous experiences and .NET Core is the result of that experiences applied to a new multi-platform framework.

I have already write about .NET Core here: Developing token authentication using ASP.NET CoreImplementing SOLID REST API using ASP.NET CoreUnit testing ASP.NET Core Identity.

The framework is movin' fast, each new release enhance and sometimes change features of the framework. The following article shows some highlights and new feature which are present in the new version of .NET Core 2.1 and ASP.NET Core 2.1.

.NET Core 2.1

The .NET team have been thinking of .NET Core 2.1 as a feedback-oriented release after the more foundational .NET Core 2.0 release.  Let's see some highlights on .NET Core 2.1:

  • Span<T>, Memory<T> introduction;
  • Windows compatibility pack;
  • Build-time performance improvement;

Span , Memory introduction

.NET Core comes with a new set of types for using arrays and other types of memory that is much more efficient. Furthermore, Span<T> and Memory<T>  are part of the System.Memory.dll package, the preview of this package is available on NuGet and it is compatibile with .NET Standard 1.1.

Actually, Span<T> and Memory<T> concept goes behind the consumer-use side. Indeed, these new types became useful under the hood of the framework, e.g. for the HttpClient, in order to improve the performance.

If you are looking for more relevant information about the performance improvement and to go in deep on these types,  please take a look to : All About Span: Exploring a New .NET Mainstay

Windows compatibility pack

The Windows compatibility pack package is useful for all the developers who want to port existing .NET Framework code to .NET Core. It increases the APIs surface to an additional 20k APIs.
You can download the package at the following link : 
The packages also provides some useful APIs in order to detect the hosting OS, for example:


Since it detects if the current OS platform is Windows, it may be useful in order to execute different code depending on the type of platform.
In addition, Microsoft has also released the following package: API Analyzer. API Analyzer is a Roslyn analyzer that comes as NuGet package. After referencing it in your project, it automatically provides live feedback on API usage and warns about potential compatibility issues and calls to deprecated APIs.

Build-time performance improvement

The following chart provides some informations about the improvement. It compares the previous version of .NET Core with the new-one:

As you can see, in .NET 2.1 preview the build time for WebSmall project is of 2.7 sec, furthermore for the WebLarge project, the build time is 22.5 sec.
The .NET team goal is to improve it with the new .NET Core 2.1 RTM version. Their plan is drop that again to 6.8 sec for WebLarge project.

ASP.NET Core 2.1

Let's talk about ASP.NET Core 2.1. The new release is targeted for mid-year 2018. It covers some improvements and features on following areas: Razor pages, SignalR, Webhooks, Security, Perfomance, MVC, Kestrel; Here is some highlights and new stuff from next release.


The HttpClientFactory brings the concept of dependency injection to HttpClient implementation. It provides a central location to manage and instantiate all HttpClient. The HttpClientFactory integrates Polly.NET. Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. HttpClientFactory has two different approaches: NamedClient, TypedClient;


The NamedClient is the default choice.

The method AddHttpClient defines a new namespace which can be used to refer the client inside your services and controllers:


The other way is by referring directly the typed client. You can define a typed client by injecting the HttpClient inside the constructor of new classes, that approach, very DI oriented, is the one I prefer:

As you can see, it allows you to register and inject directly the typed client:

Kestrel: Socket over libuv

The current implementation of Kestrel uses libuv under the hood. The implementation of the underlying libuv connection semantics has been decoupled from the rest of Kestrel and abstracted away into a new Transport abstraction. By the way, for performance reasons, Microsoft is investing on custom socket implementation inside .NET.  The sockets will replace the libuv async I/O. Furthermore, it is already possible to configure and try socket transportation, to do that you should configure it on the application Program.cs:


Nowadays, HTTPS is the default choice. Some browsers, like Chrome, starts to apply security policies behind HTTP web applications, please see: Marking HTTP As Non-Secure.
Core 2.1 comes with https by default. In other words, in addition to listing on http://localhost:5000, Kestrel will listen on https://localhost:5001 when a local development certificate is present. .NET Core SDK will install a suitable certificate by default.

Final thoughts

In conclusion, the new releases 2.1 provides a lot of useful improvements. As said before, it is based on feedback and suggestion which comes from consumers. It will also introduce some other new stuff, such as  web hooks adapted on different provides and also it will re-introduce SignalR.
For more information about the high-level planning and its related issues/features at the following link: Announcements/issues/288.

Some referral content and useful links here:
.NET Core 2.1 roadmap
ASP.NET Core 2.1 roadmap
All About Span: Exploring a New .NET Mainstay
.NET 2.1 Roadmap Pt.1 - Channel9

Cheers :)

Cover picture by Corrado Zeni

Discussion (5)

sam_ferree profile image
Sam Ferree

Thoughts on Blazor?

andreujuanc profile image
Juan C. Andreu

First time i compiled and run a Blazor project, it made me drool. It's just amazing, specially now that it's been adopted officially by Aspnet repo.

For sure, it lacks lots of feature and tools. But it's a very VERY neat idea. I do think , that if given love from the community, it will have it's niche market.

It's just amazing how you can see those dll's being downloaded on the network tab.

You can see my excitement in my tweet 2 months ago:

Check the attached pic, how amazing is that?

Obviously, it's too early, but soon it will have AoT compilation and other performance/size optimizations.

sam_ferree profile image
Sam Ferree

I'm already planning my divorce with JavaScript...

Thread Thread
andreujuanc profile image
Juan C. Andreu

If you are planning to do any frontend development, i see that as a hard thing to do. Even if blazor workss out, you still be dealing with your exwife in a costume :P

samueleresca profile image
Samuele Resca Author

Hi Sam,

I have already spoke about Blazor here :

Since August 2017, is changed a lot :). I'll try to update the article as soon as possible