Scott Hunter Details 'What's Coming with .NET Core 3.0'
After this week's release of Visual Studio 2019, Microsoft exec Scott Hunter detailed many of the new features coming in .NET Core 3. Although .NET Core 3 won't ship until the second half this year, it's available as a preview in VS 2019 so developers can try it out (with a simple tweak).
.NET Core is an open source, modular, high-performance implementation of .NET for creating Windows, Linux and Mac apps, improving upon the ageing .NET Framework that's tightly coupled to Windows.
The three main themes of .NET Core 3, Hunter said, are: desktop workloads and UI interop; artificial intelligence and machine learning; and Web app development productivity. The new support for desktop development with Windows Presentation Foundation (WPF) and Windows Forms (WinForms) has been a much-discussed feature of the upcoming .NET Core 3 offering, whose exact date is expected to be revealed at the Microsoft's Build developer conference.
With Microsoft steadily advancing the Core initiative over the past few years, .NET Core 3 is a big change from .NET Core 2, with new workloads added to those previously supported, said Hunter, director of Program Management for .NET.
"With .NET Core 1 and 2 we primarily had Web and cloud application types, in .NET Core," he said in a Channel 9 video. "We're vastly expanding the applications you can build with .NET Core 3. Now you'll be able to build desktop applications with WinForms and WPF, IoT applications running on Raspberry Pis and small devices, and with ML.NET, full support for machine learning and AI, all under .NET Core 3."
Already available in the .NET Core 3 preview for developers to try out are features such as:
- Windows desktop support with WPF and WinForms
- Flexible deployment, side-by-side support and self-contained EXE executable files
- Client-side Web development with C# and Razor
- Significant performance improvements
- New C# language features for productivity and fewer errors
Hunter also detailed new features coming in .NET Core 3 via the new C# 8.0, one of biggest feature-packed releases in a while:
- Ranges: "You can see under my GetCustomersAsync I pass in something and I basically can give it a range. Instead of giving it the full array, I can say 'take this subset of that array and pass that into that method.
- Nullable reference types: "This is one of my favorite features. We all have applications that we get no exceptions in because we didn't do the right null checks. By enabling this in C# 8 it will actually force you to put the question mark next to your customer there because it could be null and it could not be null. You can see later down there 'if name not equal null.' The compiler will actually force you to do the right null checks for it."
- Async streams: "We introduced async/await years and years ago, and when we did, it could return a single type. Now with C# 8, async can return a collection, an IEnumerable of types. For the first time ever, you can return more than one value from an async method."
- And more: "We got switch expressions, recursive patterns and a lot more as part of C# 8, there's a lot of productivity improvements there."
Hunter also discussed the .NET Core 3 introduction of .NET Standard 2.1, a formal specification of .NET APIs that are intended to be available on all .NET implementations. .NET Standard 2.1 incorporates some of those new features mentioned above, like range, and others including IAsyncEnumerable<T> and Span<T>, getting added to Base Class Library (BCL) types.
They will be available across Xamarin and .NET Core platforms, but not .NET Framework. Hunter said Microsoft doesn't expect developers to move to .NET Standard 2.1 right away, but "maybe a year or so after .NET Core 3 is out."
For more on Hunter's presentation, which also covers ASP.NET Core 3.0 and its Razor Components technology (basically server-side Blazor), interested developers can go to Microsoft's Channel 9 site or YouTube.
David Ramel is the editor of Visual Studio Magazine.