In 2019, .NET Core 3.1 was launched with a Long-Term Support (LTS) for three years. Microsoft used .NET Core 3.0 as a base for 3.1 adding new features and enhancements. These new capabilities simplify the development across many platforms. The 3.1 version focuses on fixing bugs and bringing scalability.
Businesses that want to upgrade their applications should choose the right .NET migration solution. It should ensure a smooth transition and use the latest features of .NET Core.
In this article, we explore new features in .NET Core 3.1 and how they make creating applications simpler.
What’s New in .NET Core 3.1?
.NET Core is a cross-platform implementation of the .NET ecosystem. Microsoft developed it to design web applications, services, and mobile applications. Applications built on .NET Core work across many platforms, including Windows, macOS, and Linux.
On December 3, 2019, the 3.1 version of .NET Core was released.
This new version is a long-term support (LTS) release that uses .NET 3.0 features and adds new ones. It offered improved performance, cross-platform support, and new APIs for modern application development.
.NET 3.1 provided significant performance improvements compared to previous versions. It introduced System.Text.Json as a more performant alternative to Newtonsoft.Json. This reduced memory usage and increased efficiency.
The new version introduced improvements across many platforms. It provided full support for C# 8.0 and F# 4.7. It also enhanced ASP.NET Core and Blazor for web apps. Native and single-file executables expanded deployment options.
As a result, .NET Core 3.1 makes it easier to create modern and cross-platform applications.
New Features in .NET Core 3.1
New features of .NET Core enhance application scalability and provide more flexible development. Let’s explore them.
In terms of runtime and framework improvements, .NET Core 3.1 provided full support for C# 8.0 and F# 4.7. This introduced nullable reference types, async streams, and more concise syntax for F#. Automatic memory management and type safety continued to offer a reliable development experience.
For web development, the new .NET Core brought full support for ASP.NET Core 3.1. It featured a lightweight and modular HTTP request pipeline. It also supported Entity Framework Core 3.1, enabling data access. Also, it brought partial class support for Razor components and a new Component Tag Helper for rendering components in Blazor. These new features simplify building interactive web UIs.
Desktop development received support for Windows Desktop applications using WinForms (Windows Forms) and WPF (Windows Presentation Foundation). Developers can build modern desktop apps on Windows.
Deployment options now support native executables and single-file executables. Application trimming on publish also optimized the performance. Application trimming on publish removes unused code to reduce app size and improve performance.
The updated .NET Core introduced SerialPort support on Linux. It also improved diagnostic tools for cross-platform development. These new features simplified development and troubleshooting across different operating systems.
Updates for networking included HTTP/2 support in HttpClient and TLS 1.3 support on Linux with OpenSSL 1.1.1. This improved communication security and performance.
As a Long-Term Support release, .NET Core 3.1 provides stability and extended support for enterprise applications.
.NET Core 3.1 Performance Enhancements
For a smooth user experience, applications should run faster and handle more requests. For this reason, the new .NET Core had enhancements, particularly in throughput and response time. Upgrading to .NET Core 3.1 brought measurable performance gains.
.NET Core 3.0, the System.Text.Json library was already introduced. The support continued in 3.1. It offered a high-performance alternative to Newtonsoft.Json. It reduced memory usage and improved throughput for applications.
Key Differences Between .NET Core 3.1 and .NET Core 3.0
As already established, .NET Core 3.1 was a modification of .NET Core 3.0. It focused on stability and bug fixes. One of the differences was that .NET Core 3.1 became a Long-Term Support (LTS) release with three years of support. This made version 3.1 a more stable and recommended option for production applications.
But .NET Core 3.1 removed certain components.
Several legacy Windows forms were removed in .NET Core 3.1. Microsoft replaced them with more modern alternatives introduced in .NET Framework 2.0. The removed controls include:
- DataGrid (replaced by DataGridView)
- ToolBar (replaced by ToolStrip)
- ContextMenu (replaced by ContextMenuStrip)
- Menu (replaced by ToolStripDropDown or ToolStripDropDownMenu)
- MainMenu (replaced by MenuStrip)
- MenuItem (replaced by ToolStripMenuItem)
The removal of these controls required developers to migrate to the recommended replacements.
Along with the features listed above, various minor APIs were removed from .NET Core 3.1. For example, associated APIs like the ‘Shortcut’ enum were removed. Developers needed to use newer APIs like ‘Keys’ for shortcuts.
By removing these legacy components, Microsoft aimed to simplify the framework. The company also strived to reduce maintenance overhead. This encouraged developers to adopt modern APIs and patterns.
ErrorViewModel in ASP.NET Core 3.1
In ASP.NET Core 3.1, the “View Was Not Found” server error might occur. It happens when the application attempts to render a view that does not exist or is incorrectly referenced. This results in an ‘InvalidOperationException’. The system searches for the missing view in predefined locations but fails to locate it. Properly handling this exception is crucial for a smooth user experience.
When a “View Not Found” error occurs, it’s better to return a more informative HTTP response. For example, a ‘404 Not Found‘ response instead of a ‘500 Internal Server Error‘. This can result in better clarity to the user.
To handle the “View Was Not Found” server error, developers can:
- Configure middleware to catch ‘InvalidOperationException’ for missing views. Redirect to custom error pages.
- Use ‘ProblemDetails’ for structured error responses, especially for APIs.
- Install logging for “View Not Found” errors and confirm view references in your code.
Proper error handling is necessary for application stability and usability.