- One big thing: .NET 6 Preview 2 is here
- The little things: Azure Functions .NET 5 support goes GA, new .NET APIs coming, event sourcing examples
- Last week in the .NET world
Last week, Microsoft released .NET Preview 2. From here on out, the .NET team will ship a new preview every month until .NET 6 goes live in November 2021. As a reminder, .NET 6 is an LTS release, meaning Microsoft will support it for three years.
A big focus for .NET 6 is improving the inner loop experience and performance: maximizing developer productivity by optimizing the tools we use. While it’s early Stephen Toub writes that the team has trimmed overheads when running
dotnet build, and
dotnet run. This includes fixing issues where tools were unexpectedly JIT’ing and changing the ASP.NET Razor compiler to use a Roslyn source generator to avoid extra compilation steps. A chart of the drastic build time improvements shows a clean build of Blazor Server decreasing from over 3600 milliseconds to around 1500 milliseconds. If you bundle this with a best-in-class hot reload capability, developers have a lot to be excited about with .NET 6.
In .NET 6, you’ll be hearing a lot about MAUI (Multi-Platform App UI), which is the next iteration of Xamarin.Forms. With MAUI, Xamarin developers can use the latest .NET SDKs for the apps they build. If you aren’t a Xamarin developer, you can still take advantage of MAUI: for example, using MAUI Blazor apps can run natively on Windows and macOS machines. With Preview 2, Microsoft enabled a single-project experience that reduces overhead when running Android, iOS, and macOS apps.
While .NET library improvements don’t come with the same fanfare, a couple of improvements caught my eye. The
System.Text.Json library now has a
ReferenceHandler.IgnoreCycles option that allows you to ignore cycles when you serialize a complex object graph—a big step for web developers. Little by little, Microsoft’s Newtonsoft comparison chart is getting better. Additionally, a new
PriorityQueue<TElement, TPriority> collection enables you to add new items with a value and a priority.
Aside from the Razor performance improvements, ASP.NET Core now has support for custom event arguments in Blazor, CSS isolation for MVC and Razor Pages, and the ability to preserve prerendered state in Blazor apps. (And no, AOT is not ready yet—the comment CTRL + F “AOT” 0 results, closes the tab from the last preview is the hardest I’ve laughed in a while.) In Entity Framework Core land, the team is working on preserving the synchronization context in
SaveChangesAsync, flexible free-text search, and smoother integration with
The little things: Azure Functions .NET 5 support goes GA, new .NET APIs coming, event sourcing examples
I’ve mentioned this a few times before, but the Azure Functions team has developed a new out-of-process worker that will help with quicker support of .NET versions. Here’s the gist of why they are decoupling a worker from the host, from Anthony Chu:
The Azure Functions host is the runtime that powers Azure Functions and runs on .NET and .NET Core. Since the beginning, .NET and .NET Core function apps have run in the same process as the host. Sharing a process has enabled us to provide some unique benefits to .NET functions, most notably is a set of rich bindings and SDK injections. … However, sharing the same process does come with some tradeoffs. In earlier versions of Azure Functions, dependencies could conflict. While flexibility of packages was largely addressed in Azure Functions V2 and beyond, there are still restrictions on how much of the process is customizable by the user. Running in the same process also means that the .NET version of user code must match the .NET version of the host. These tradeoffs of sharing a process motivated us to choose an out-of-process model for .NET 5.
A few weeks ago, I wrote about how you can use this with .NET 5 today, but it was very much in preview and involved a lot of manual work. This week, it became production-ready. .NET 6 will support both the in-process and out-of-process options so that .NET Core 3.1 can remain supported. Long term (for .NET 7 and beyond), the team hopes to move new feature capabilities to the out-of-process worker completely—allowing support of .NET 7 on Day 1 from only the isolated worker.
The .NET team approved a proposal for a new Timer API. As ASP.NET Core architect David Fowler notes in the issue, the current implementation can incur overlapping callbacks (which aren’t async). Additionally, he notes it always captures the execution context, which can cause problems for long-lived operations. How will this new API help? It pauses when user code is executing while resuming the next period when it ends, can be stopped using a
CancellationToken, and doesn’t capture an execution context. If you’re only firing a timer once,
Task.Delay will continue to be a better option.
Also, .NET is getting a new
Task.WaitAsync API. This appears to replace
WhenAny, allowing Microsoft to assure us that naming things is still the hardest part of computer science. I say call it
WhenAsync. If you look at the name hard enough after a few drinks,
WhenAny is still there.
If you’re into event sourcing, check out Oskar Dudycz’s EventSourcing.NetCore repo. It’s full of nice tutorials and practical examples. That’s all.
Lastly, a nice tip on how you can tell when a site’s static file was last updated (even if several factors can make this unpredictable).
Did you know web servers tell you when a static file on a website was last updated? There's a LOT of caveats since many things can influence this timestamp, do NOT blindly trust it, but it can be helpful.— SwiftOnSecurity (@SwiftOnSecurity) March 13, 2021
F12 > Network > Select file in list > Headers
Look for "last-modified" pic.twitter.com/8WGRyfQeGe
- Richard Lander announces .NET 6 Preview 2. Daniel Roth writes about ASP.NET Core updates and Jeremy Likness updates us on Entity Framework Core.
- Elton Stoneman runs containers in Azure VM Scale Sets instead of using Kubernetes.
- Sudhir Jonathan writes a big little guide to message queues.
- David Ramel writes about MAUI support with .NET 6 Preview 2.
- Angelos Petropoulos writes about what’s new with GitHub Actions tooling in Visual Studio.
- Anthony Chu provides an update on .NET Azure Functions support.
- For community standups: the EF team talks to Julie Lerman, ASP.NET discusses contributing to Blazor, and the Languages & Runtime team discusses the C# design process.
- The .NET Docs Show talks with Yair Halberstadt about compile-time DI.
- Claudio Bernasconi works with Blazor form validation.
- Madhu Sudhanan P builds a Blazor app with Dapper.
- Rick Strahl writes about role-based JWT tokens in ASP.NET Core, and Jason Farrell performs manual JWT validation in .NET Core.
- The Code Maze blog introduces benchmarking C# and ASP.NET Core projects.
- Khalid Abuhakmeh answers a question about working with data in an HTTP API, and also hosts two ASP.NET Core apps in one host.
- Damien Bowden secures Blazor WebAssembly using cookies.
- Jeremy Miller uses Alba to integration test ASP.NET services.
- Sam Basu works on a real-time WinUI dashboard with a SignalR backend.
- Matthew Jones wraps up building a blackjack game in Blazor.
- Aleksandr Hovhannisyan writes about why he doesn’t like Tailwind.
- Mark Downie writes about the rundown provider.
- David Ramel writes about the new .NET Upgrade Assistant.
- Arthur Casals writes about Project Reunion 0.5 Preview.
- Konrad Kokosa shows .NET debugging in a single picture.
- Anthony Chu writes about running Node.js 14 with Azure Functions.
- James Randall compares performance between AWS Lambda and Azure Functions.
- Scott Hanselman starts using Azure Static Web Apps.
- Johnny Reilly uses Managed Identity, Azure SQL and Entity Framework.
- Jiří Činčura shows off ConfigureAwaitChecker with support for “await using” and “await foreach” .
- Niels Swimberghe downloads the right ChromeDriver version and uses C# to keep it up to date on Windows, Linux, and macOS.
- Thomas Claudius Huber writes about covariant return types in C# 9.
- Andrea Chiarelli writes about five C# features you might not know about.
- Jeff Fritz writes about LINQ.
- Mark Seemann uses sealed by default, for C# classes.
- Munib Butt writes about pattern matching in C#.
- Jason Roberts writes about default interface implementations in C#.
- Scott Hanselman shows off the GitHub command line.
- Richard Lander uses blinking APIs with Raspberry Pi and .NET.
- Check out Oh My Git, a fun way to learn the ins and outs of Git.
- Mislav Marohnić scripts with the GitHub CLI.
- Andrew Lock installs Docker Desktop for Windows and WSL 2.
- Imar Spaanjaars sets up a CI pipeline in Azure DevOps to build and test code.
- Oskar Duducz has a GitHub repo showing off examples and resources for using event sourcing in .NET Core.
- Regis Wilson asks: why is Kubernetes so hard?.
- Neel Bhatt takes a look at InferSharp.
- Laurent Kempé gets started with Dapr for .NET developers.
- Thomas Ardal shows off 6 free tools for .NET developers.
- Nick Randolph converts Xamarin.Forms to WinUI and Uno.
- Selva Ganapathy Kathiresan writes about the advantages of using MAUI over Xamarin.
- Uduak Obong-Eren writes about red flags to look out for while interviewing.
- Mauro Servienti writes about how not all changes are equal.
- The ThoughtWorks blog continues writing about Kubernetes adoption best practices.
- Oren Eini writes about a coding interview that he failed.
- The .NET Rocks podcast talks to Daniel Roth about .NET 6.
- The Xamarin Podcast offers an update on MAUI.
- The Adventures in .NET podcast talks to Daniel Roth about Blazor.
- The Merge Conflict podcast introduces microservices.
- The 6-Figure Developer podcast talks GitOps with Kelsey Hightower.
- James Montemagno discusses whether you should develop in Xamarin today or wait for MAUI.
- Scott Hanselman and Azure Barry discuss what to use for monitoring your applications in Azure, and also discuss what to use for deploying and testing your applications in Azure.
- The ON .NET Show builds microservices with Tye, and also discusses commands, queries, and other fun architectural patterns.