With .NET 5 shipping this week, it’s going to be such a release.
On tap this week:
- .NET 5 officially launches tomorrow
- Are C# 9 records actually immutable by default?
- Last week in the .NET world
After eight preview releases, two release candidates, and some tears—by me, working on the early preview bits—it’s finally happening: .NET 5 ships tomorrow. Of course, the release candidates shipped with a go-live license but everything becomes official tomorrow. You’ll be able to download official bits and we might even see it working with Azure App Service (no pressure). There’s also .NET Conf, where you’ll get to geek out on .NET 5 for three straight days.
It’s been a long time coming—and it feels a bit longer with all this COVID-19 mess, doesn’t it? Even so, the “Introducing .NET 5” post hit about 18 months ago—and with it, the promise of a unified platform (with Xamarin hitting .NET 6 because of pandemic-related resourcing constraints). We’re talking a single .NET runtime and framework however you’re developing an app, and a consistent release schedule (major releases every November).
Of course, this leads to questions about what it means to say .NET Framework, .NET Standard, and .NET Core—not to mention how the support will work. I covered those not-sexy-but-essential questions two weeks ago.
Since I started this newsletter in May (we’re at Issue #25!), we’ve been dissecting what’s new week by week. (You can look at the archives on my site.) For a condensed version, here’s my favorite things about .NET 5—both big and small. (This is a little like talking about your favorite song or movie, so your opinions might differ.)
ASP.NET Core now ships with a built-in JSON formatter that emits structured JSON logs to the console. Is this a huge change? No. Will it make my life easier on a daily basis. You know it.
In .NET 5, running
dotnet watch on an ASP.NET Core project now launches the default browser and auto-refreshes on save. This is a great quality-of-life developer experience improvement, as we patiently await for this to hit Visual Studio.
When you create a new API project using
dotnet new webapi, you’ll see OpenAPI output enabled by default—meaning you won’t have to manually configure the Swashbuckle library and the Swagger UI page is enabled in development mode. This also means that F5 now takes you straight to the Swagger page instead of a lonely 404.
If you have some time to kill and aren’t scared off by low-level details, I’d highly recommend Stephen Toub’s July post on .NET 5 performance improvements. In short, text operations are 3x-5x faster, regular expressions are 7x faster with multiline expressions, serializing arrays and complex types in JSON are faster by 2x-5x, and much more.
EF Core 5 is also shipping with a ton of new features. Where to begin? Well, there’s many-to-many navigation properties (skip navigations), table-per-type inheritance mapping, filtered and split includes, general query enhancements, event counters,
SaveChanges events, savepoints, split queries for related collections, database collations, and … well, check out the What’s New doc for the full treatment.
Single-file apps are now supported with .NET 5, meaning you can publish and distribute an app in a single executable. Hooray.
I’m super excited for the release of C# 9, especially the embracing of paradigms common in functional programming. With init-only properties and records, C# developers have the flexibility to easily use immutable constructs in a mutable-by-design language. It might take some getting used to, but I love the possibilities. I see a lot of promise in keep the real-world object modeling, but also introducing immutability where treating objects as data makes sense.
Speaking of records, there seems to be some confusion on if C# 9 records are immutable by default. The answer is: yes, and no. Records are immutable by default when using positional arguments. When you want to use them with object initializers, they aren’t—which makes sense, since initializers are more flexible in how objects are constructed.
Feel free to check out my post for the full details.
Someone has turned a lucky … um … well, numbers don’t matter, do they? Happy Birthday, Dad. You can thank him for … waves hands … all this. I’m not sure what I’d be doing without him encouraging my nerdy tendencies during my most awkward years, but I’m glad I’ll never have to find out. Have a good day, mister.
When I said I like to wear many hats, I didn’t mean this one.
(Don’t worry, this is the last birthday wish. Back to regularly scheduled programming.)
- Beth Massi previews .NET Conf from November 10-12.
- Damien Bowden implements a Blazor full text search using Azure Cognitive Search.
- Irina Scurtu works with .NET Core with nginx on Linux, and also talks about using a .NET API as a Linux service.
- Eilon Lipton runs through preview 5 of Blazor Mobile Bindings.
- AWS has stopped supporting AWS SDK for .NET version 1.
- Microsoft Learn has launched a .NET Learn Challenge.
- The .NET Docs show talks about navigating ML.NET with Bri Achtman and Luis Quintanilla.
- Just two .NET standups this week: Machine Learning talks TorchSharp & Tensor programming, and Xamarin discusses Mobile Blazor Bindings.
- Dave Brock (ahem) talks about updating the HTML head from a Blazor component.
- Jon Hilton talks about migrating from MVC to Blazor.
- Kristoffer Strube sends push notifications to a browser in ASP.NET Core.
- Paul Michaels documents some recent tag helper issues.
- Sam Xu introduces ASP.NET Core OData 8.0 routing.
- Imar Spaanjaars discusses implementing health checks in ASP.NET Framework apps.
- Jason Gaylord discusses building APIs with GraphQL and .NET Core post 1, post 2.
- Ricardo Peres talks about some gotchas with ASP.NET Core areas.
- David Grace deals with ASP.NET Core Web API access restrictions and errors in Azure.
- Justin Yoo writes about GitHub Actions, DNS, and SSL certs on Azure Functions.
- Tore Nestenius stores the ASP.NET Core Data Protection Key Ring in Azure Key Vault.
- Laurent Bugnion talks about the best practice when naming Durable Functions in C#.
- Joe “Hulk Hogan” Guadagno works with NLog, dependency injection, and Azure Functions.
- Dave Brock (ahem) asks: are C# 9 records immutable by default?
- Anthony Giretti works with GetEnumerator extension support for foreach in C# 9.
- Jiří Činčura discusses the new Environment.ProcessId in .NET 5.
- Steve Gordon discusses additional HTTP, sockets, DNS, and TLS telemetry in .NET 5.
- Thomas Levensque uses C# 9 records as strongly-typed IDs.
- Khalid Abuhakmeh takes a look at System.IO.Path.
- Derek Comartin talks about CQRS myths.
- Tim Heuer generates a GitHub Actions workflow file from the dotnet CLI.
- Kunal Chowdhury offers some advanced Git tips.
- Vicente Gerardo Guzmán Lucio protects sensitive data in the background.
- Leomaris Reyes walks through the best Xamarin Forms app examples, and also gets started with text-to-speech.
The .NET Rocks podcast discusses Cake 1.0 with Mattias Karlsson.
- The Loosely Coupled Show asks: should you learn a functional programming language?
- The Visual Studio Toolbox talks about GitHub Codespaces.
- The folks at Compositional IT talk quickly about SAFE Stack web apps pn Azure Static Web Apps.
- Over at ON.NET, they talk about the inner loop with VS Code and GitHub, and also real-time data fetching with GraphQL and Blazor.