Microsoft .NET Core 3x+ Insights

dotnet5_platform.png

. NET Core 3 was announced on May 7, 2019, at Microsoft Build. Version 3.0 was released September 23 2019, followed quickly by version 3.1 on December 3, 2019.

EQengineered began working with .NET Core 3.0+ in October of 2019. Russ Harding, EQengineered’s Microsoft Practice Lead and Principal Technical Consultant/Architect, catalogued the below insights related to the platform.

Key Insights

  • Modular/Flexible; DotNet Core 3.x made huge improvements to streamline and abstract modular components.

  • Native use of dependency injection, a key component in enabling a more modular architecture.

    • Only need a DI module for a single web api route? Access DI Objects from WebApi end points, no need to instantiate objects for the whole class if only used in a single method.

    • Public async Task<ActionResult> Delete([FromServices]ICustomInterface customObject) {customObject.CustomMethod();}

  • Easily replace native functionality with 3rd party libraries. Examples include:

    • Native dependency injection can be replaced with AutoFac

    • System.Text.Json can be reverted back to use Netwonsoft.Json

Before Updating to .NET Core from .NET (netfx)

  • Review/Update 3rd party libraries.

  • Remove unused 3rd party libraries.

  • Identify any desired platform changes.

  • Async/await is deeply integrated with .NET Core; update where practical ahead of time.

Nuget

Not all packages can make use of the new features.

  • Endpoint routing is not supported by all 3rd party components.

    • Example: Microsoft OData won’t support endpoint routing until .NET 5.

  • Nuget offers a new feature for displaying deprecated packages.

    • New feature, and you should not expect many package manufactures to go back and properly mark obsolete packages so you will need to be diligent.

  • Packages that depend on .NET directly, or indirectly are not always obvious. Visual studio will give a warning, but you will need to dig a bit to determine where the netfx dependency is.

Packages that depend on .NET directly, or indirectly, are not always obvious. Visual studio will give a warning, but you will need to dig a bit to determine where the netfx dependency is.

Life Changing

  • No more binding redirects in your web/app.config files! 

  • Those nasty "Could not load file or assembly ‘System.<…>…’ or one of its dependencies…." error messages are gone in .NET Core!

Closing

There are a lot of things to take into consideration when modernizing your software project and how .NET Core can play a role in that is a substantial part of that process. The lists above are just of the few things that spring quickly to mind and can hopefully serve as a starting point for you during your project.

Microsoft will be jumping from .NET Core 3.0 to .NET 5 in an effort to remove confusion for .NET Framework users, who have been using the 4.x series. It is removing the “Core” from its name to further enforce the idea that .NET 5 will have uniform capabilities and behaviors. .NET 5 will ship in November 2020, with a preview release in the first half of 2020. After .NET 5 is released, Microsoft will ship a new major version of .NET every November.

Russ Harding