Categorías
Blog
Tech Blog

What’s new in .NET Core 3?

A few weeks ago, a new major version of .NET Core was released! .NET Core 3 is now generally available, and being such a fast-evolving platform, it brings a lot of changes and improvements that we would like to share with you. It is recommended to update as soon as possible because .NET Core 2.2 reaches end-of-life in December. This will be the last major release of .NET Core because as of next year, the whole .NET platform will become unified into .NET 5. 

Background

In Media Interactiva a lot of our projects are powered by Microsoft technologies. Our whole architecture runs on a myriad of Azure services; we build the Microsoft Official practice tests for Microsoft (as well as other tech companies like Cisco and VMWare). We are also heavily invested in containerization and are moving most of our services to Kubernetes.

Although we are not restricted to .NET, it is a very important technology for us, and its relevance is growing within our organization. Over time, we have had the chance to see the evolution, from .NET Framework to .NET Core, and how .NET Core has matched perfectly with our desire to have a modern, potent and productive stack that can power our market-leading learning solutions. We have 20 developers using .NET technologies across several framework versions in our production teams. We would like to share with you what we consider the major highlights of this release.

C# 8 Improvements

A new iteration for C# has been released! C# 8 is not a big release. It does not include a whole lot of big and shiny features, like other releases in the past. Nonetheless, there are quite a few interesting improvements for .NET developers:

  • The nullable system is modified to allow compile-time enforcement of nullability for reference types. This allows the developer to express their intent as to whether a variable could or could not be null and therefore contributes to reduce those dreaded (and usually unexpected) NullReferenceExceptions. 
  • Interfaces can now include a default implementation. This allows an interface to be extended with new members without immediately causing a compile error on the implementers. Previously you could only avoid that with extension methods. This has been the most controversial feature for this release, as it brings multiple inheritances into the language.
  • Other goodies: there are two syntax improvements that will be useful for writing clearer and terser code. On one hand, using statements can now be expressed without the need for braces. On the other hand, switch expressions received improvements for easier syntax and pattern matching.

Those features add icing on the cake for a language that we daresay, is one of the most powerful out there, and certainly one of the comfiest to work with.

gRPC

We are also very excited about the full integration of gRPC with ASP.NET! At Media Interactiva we are moving steadily towards a distributed, microservice architecture. This has helped our teams to be more independent, to have more maintainable code, and to try new things continuously. However, it does not come without its caveats. As the complexity of the whole platform grows, it becomes more difficult to ensure API contracts between all the services. And, in those cases when asynchronous communication does not fit, we need our services to communicate in a fast, reliable and efficient way, avoiding latency as much as possible.

For those unaware, gRPC is an RPC-style framework, developed and driven by Google, which essentially allows you to define services and messages with a platform-agnostic interface definition language, and using it to generate servers and clients dynamically for every supported language. It works over HTTP/2 and provides a highly-performant binary serialization format, which makes it a very fast protocol.

It has been available to .NET for quite some time, but on .NET Core 3, gRPC is now an integral part of the platform, integrating flawlessly in the ASP.NET pipeline, benefitting from existing middleware, authentication, and everything else. We have been fiddling with it, and it has been very exciting! The tooling is still missing a bit of maturity, but it is very promising, and the problems are small and easily avoidable.

Other mentions

The previous two features are the most relevant to us, but they are not all that have been included! An article about .NET Core 3 cannot be complete without mentioning the inclusion of support for WPF and Windows Form! This only works on Windows, but it finally brings GUI capabilities to .NET Core.

HTTP/2 support has been added to the HttpClient, which together with the support for Kestrel that was previously added, allows us to have full end-to-end support for the protocol and achieve better performance.

And lastly, we finally say goodbye to Json.NET. It has served well all these years, but a new, built-in library that provides better performance with a lower memory footprint has come to take its place. It can be added back if needed for projects requiring backwards compatibility but does not ship by default anymore.

If you are as excited about .NET as we are, let us know! We are always looking for passionate .NET developers to join our teams and continue evolving our apps and tools. Visit our website and see our open positions at http://bit.ly/2WPIZeS

 

 

Carlos Sánchez

Analista Programador