News

Microsoft Releases 'Small and Short' .NET Core 3.1

Microsoft shipped .NET Core 3.1, described as a "small and short release" that focuses on two of the big features highlighting the Sept. 23 release of .NET Core 3.0: Blazor (for C# Web development instead of JavaScript) and desktop development (Windows Forms and Windows Presentation Foundation).

As the dev team has been primarily polishing up those and other existing features found in the milestone v.3.0 release, v3.1 is mostly notable for its licensing, Microsoft indicated.

"The most important feature is that .NET Core 3.1 is an long-term supported (LTS) release and will be supported for three years," said program manager Richard Lander. "As we've done in the past, we wanted to take our time before releasing the next LTS release. The extra two months (after .NET Core 3.0) allowed us to select and implement the right set of improvements over what was already a very stable base. .NET Core 3.1 is now ready to be used wherever your imagination or business need takes it."

.NET Core 3.1 is also known for Blazor, the ASP.NET Core technology that puts WebAssembly to use as a browser compilation target for higher-order programming languages so they can be used in Web development instead of JavaScript. That opens up Web development to a a whole new audience of C# jockeys who heretofore didn't want to mess with JavaScript.

Microsoft previously outlined what was new in an ASP.NET Core 3.1 preview, which includes:

  • New component tag helper: This is said to ease the use of Razor components from views and pages, which previously required rendering a component from a view or page using the RenderComponentAsync HTML helper. "The new component tag helper simplifies the syntax for rendering components from pages and views. Simply specify the type of the component you wish to render as well as the desired render mode. You can also specify component parameters using attributes prefixed with param-."
  • Prevent default actions for events in Blazor apps: "You can now prevent the default action for events in Blazor apps using the new @oneventname:preventDefault directive attribute."
  • Stop event propagation in Blazor apps: "Use the new @oneventname:stopPropagation directive attribute to stop event propagation in Blazor apps."
  • Validation of nested models in Blazor forms: This experimental feature, presented for early developer feedback rather than inclusion in .NET Core 3.1, improves on the existing built-in DataAnnotationsValidator used to validate form input using data annotations. It can only validate top-level properties of a model bound to a form. "To validate the entire object graph of the bound model, try out the new ObjectGraphDataAnnotationsValidator available in the experimental Microsoft.AspNetCore.Blazor.DataAnnotations.Validation package."
  • Detailed errors during Blazor app development: This helps developers get detailed error information in order to troubleshoot and fix issues. "Blazor apps now display a gold bar at the bottom of the screen when an error occurs. During development, in Blazor Server apps, the gold bar will direct you to the browser console where you can see the exception that has occurred."

In the Dec. 3 post about what's new in ASP.NET Core 3.1, Microsoft highlighted partial class support for Razor components. "Razor components are now generated as partial classes" Microsoft said. "Code for a Razor component can be written using a code-behind file defined as a partial class rather than defining all the code for the component in a single file. For more information, see Partial class support."

While that covers the Web/Blazor side of things, the other main point of focus, desktop development, is marked by one "unfortunate breaking change" in .NET Core 3.1 resulting from the removal of Windows Forms controls, specifically: DataGrid, ToolBar, ContextMenu, Menu, MainMenu and MenuItem. They are being replaced by newer controls that have been around for a while, but still may be in use by some developers.

"You will see build breaks if you are using the controls we removed in your applications," Microsoft said. "Also, if you open .NET Core 3.0 applications in the latest versions of the .NET Core Windows Forms designer, you will see errors if you are using these controls. We recommend you update your applications to .NET Core 3.1 and move to the alternative controls. Replacing the controls is a straight-forward process, essentially 'find and replace.'"

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube