The .NET Stacks #31: đŸ„ł 10 things to kick off '21

This week, we kick off 2021 with a busy issue.

Dave Brock
Dave Brock

Note: This is the published version of my free, weekly newsletter, The .NET Stacks. It was originally sent to subscribers on January 4, 2021. Subscribe at the bottom of this post to get the content right away!

Well, friends, our dream has finally come true: 2020 is now over.

I hope your 2021 is off to a great start, and also hope you and your families were able to enjoy the holidays. I was lucky enough to take a break. I kept busy: hung out with the kids, watched a bunch of bad TV, worked out (which included shoveling snow three times; thanks, Wisconsin), tried out streaming, hacked around on some side projects, and generally just had fun with the time off.

This week, let’s play catch up. Let’s run through 10 things to get us ready for what’s to come in 2021. Ready?


With .NET 5 out to the masses, we’re beginning to get past a lot of the novelty of source generators—there’s some great use cases out there. (If you aren’t familiar, source generators are a piece of code that runs during compilation and can inspect your app to produce additional files that are compiled together from the rest of your code.)

To that end, Tore Nestenius writes about a source generator that automatically generates an API for a system that uses the MediatR library and the CQRS pattern. What a world.

Expect to see a lot of innovation with source generators this year.


In my Blast Off with Blazor blog series, I’ve been using Tailwind CSS to mark up my components—you can see it in action where I build a responsive image gallery. Instead of Bootstrap, which can give you previously styled UI components, it’s a utility-first library that allows you to style classes in your markup. You can avoid the hassle of overriding stylesheets when things aren’t to your liking.

To be clear, you may cringe at first when you see this. (I know I did.)

<div class="m-6 rounded overflow-hidden shadow-lg">
    <img class="w-full h-48 object-cover" src="@ImageDetails.Url" alt="@ImageDetails.Title" />
    <div class="p-6">
        <div class="flex items-baseline">
            <!-- stuff -->
        </div>
        <h3 class="mt-1 font-semibold text-2xl leading-tight truncate">@ImageDetails.Title</h3>
    </div>
</div>

Once you get used to it, though, you’ll begin to see its power. Adam Wathan, the creator of Tailwind, wrote a piece that helps you get over the initial visceral reaction.


Over the weekend, I asked this question:

This led to entertaining answers. A lot of people talked about going professional with their hobbies, like with music and art. I also found it interesting how many answers had parallels to programming, like being a cook, architecting buildings, and building and maintaining things.


What can’t you do with GitHub Actions? David Pine wrote an Action that performs machine-translations from Azure Cognitive Services for .NET localization. Tim Heuer used GitHub Actions for bulk resolving. Of course, you could go on and on.

The main use case is clear: workflows centered around your GitHub deployments, which goes hand-in-hand with it being the long-term solution to the Azure DevOps platform. My prediction is that in 2021, the feature gap between Azure DevOps and GitHub Actions will narrow significantly.

The success of GitHub Actions is sure to blur the lines between all the Microsoft solutions—between Azure Functions, Actions, and WebJobs, for example. While the main use case for Actions is deployment workflows, it’s hard to beat an app backed by a quick YAML file.


We’ve talked about System.Text.Json quite a few times before. The gist from those posts: System.Text.Json is a new-ish native JSON serialization library for .NET Core. It’s fast and performant but isn’t as feature-rich as Newtonsoft.Json (this table gets worse the more you scroll)—so if you’re already using Newtonsoft, stick with it unless you’ve got advanced performance considerations.

A few days after Christmas, Microsoft’s Layomi Akinrinade provided an update on System.Text.Json. .NET 5 was a big release for the library, as they pushed a lot of updates that brought more Newtonsoft-like functionality: you’ll see the ability to deserialize paramterized constructors, conditionally ignoring properties (thank you), C# record types, and constructors that take serialization defaults.

With .NET 6, Microsoft plans to “address the most requested features that help drive System.Text.Json to be a viable choice for the JSON stack in more .NET applications.” This is after writing (in the same post) that in .NET Core 3.0, “we made System.Text.Json the default serializer for ASP.NET Core because we believe it’s good enough for most applications.” So, that’s interesting. With Newtonsoft expected to top the NuGet charts for the foreseeable future, it’s nice to see Microsoft understanding there’s much work to do, still, to encourage folks to move over to their solution.


Egil Hansen, the man behind bUnit—the Blazor component testing library—describes how component vendors can make their components easily testable with a one-liner. Developers can now call an extension method based on bUnit’s TestContext that users can call before kicking off tests. The extension method can then be published as a NuGet package with a version matching the compatible library.

Check out the Twitter thread for details.


Did you know that you can target attributes in C# 9 records using a prefix of property: or field:? You do now.


The .NET Foundation released their November/December 2020 update just before the holidays. There’s a community survey you can fill out, that’s available until the end of March. They’ve also launched a speaker directory.


Speaking of the .NET Foundation, tonight I watched board member Shawn Wildermuth’s new film, Hello World. It begins as a love letter to our industry, then takes a sobering look at our diversity and inclusion issues. It’s a wonderful film that everyone should see. It’s a cheap rental (check out the site to see where to rent it)—and once there you can also help support organizations that are helping push our industry to where it should be.


As you may or may not have noticed, the Azure SDKs have gotten a facelift. During our break, Jeffrey Richter wrote about its architecture.

Crucial to the SDK design—and most importantly, crucial to me—is that retry and cancellation mechanisms are built in. Additionally, you can implement your own policies in their pipeline (think ASP.NET Core middleware) for things like caching and mocking. Right on cue, Pavel Krymets writes about unit testing and mocking with the .NET SDKs.


🌎 Last week in the .NET world

đŸ”„ The Top 3

📱 Announcements

📅 Community and events

đŸ„… The .NET platform

🌎 Web development

⛅ The cloud

📔 Languages

🔧 Tools

🔐 Security

👍 Design, architecture, and testing

đŸ“± Xamarin

đŸŽ€ Podcasts

đŸŽ„ Videos

.NET Stacks