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 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:
What would you be doing for a living if computers or software didn't exist? I literally have no idea.16:56 PM - 02 Jan 2021
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
- Tore Nestenius uses source generators with C# 9 and .NET 5 for MediatR and CQRS.
- Niels Swimberghe pre-renders Blazor Web Assembly at build time for SEO.
- Andrew Lock compares using self-contained or framework-dependent publishing in Docker images.
đą Announcements
- Nat Friedman writes how GitHub removed all cookie banners from GitHub.
- The Uno Platform writes about the developments to look forward to in 2021.
- Tobias Ahlin discusses how the GitHub globe was built.
- Google Chrome is testing larger cache sizes for performance.
- Microsoft Learn has learning path for creating serverless applications.
- Layomi Akinrinade writes about whatâs next for System.Text.Json.
đ Community and events
- Maarten Balliauw recaps all the (free!) JetBrains community webinars.
- Matthew MacDonald writes about .NETâs third-party software problem.
- The .NET Foundation provides a November/December 2020 update.
- Telerik pulled together a Q&A from a recent .NET 5 webinar.
đ„ The .NET platform
- Josef Ottosson writes about efficient file uploads with .NET.
- Kristoffer Strube adds the User-Agent header to HttpClient.
- Immo Landwerth writes about transitioning from .NET Standard to .NET 5.
đ Web development
- Sam Walpole optimizes background tasks using Hangfire and ASP.NET Core.
- Ed Charbeneau writes about 10 Blazor features you might not know about.
- Dave Brock builds a responsive image gallery in Blazor, and prerenders a Blazor Web Assembly application.
- Sean Franklin uses Blazor Server to store encrypted session data in the browser.
- Wael Kdouh writes about microfrontends with Blazor Web Assembly.
- Niels Swimberghe interacts with JavaScript objects using the new IJsObjectReference in Blazor, deploys Blazor Web Assembly to Firebase Hosting, and fixes Blazor Web Assembly PWA integrity checks.
- David Grace writes about client-side UI events and other common queries in Blazor.
- Marinko Spasojevic writes about 2-step verification with Angular and ASP.NET Core Identity.
- Mitchel Sellers writes about real world localization with ASP.NET Core 5.
â The cloud
- David Pine writes a GitHub Action to perform machine translation with Azure Cognitive Services.
- Jeffrey Richter walks us through the Azure SDK architecture.
- David Ellis offers tips on how to save when running .NET on Azure.
- Tim Heuer uses GitHub Actions for bulk resolving.
- Damian Brady uses GitHub Actions for Azure Machine Learning.
- Paul Michaels uses Managed Identity with Azure Key Vault, and receives messages through the Azure Service Bus.
- Samson Amaugo makes a CRUD API using Azure Functions and Azure Cosmos DB.
đ Languages
- Khalid Abuhakmeh writes about C# 9 covariant return types, and warns about C# 9 record gotchas.
- Patrick Smacchia writes about the proper usages of exceptions in C#.
- Steve Gordon plays with C# 9 top-level programs, records, and Elasticsearch.NET.
- John Reilly writes about nullable reference types in C#.
- Eric Potter writes about init-only setters in C# 9.
- Thomas Levesque shows off how you can use C# 9 records with EF Core.
- Mark Heath weighs performance and readability when storing coordinates in C#.
- Reed Copsey binds with F#.
- Riccardo Terrell builds a recommendation engine with ML.NET and F#.
- Jamie Dixon looks at the SARS-CoV-2 genome with F#.
đ§ Tools
- Mark Heath configures SQL Server dependencies in ASP.NET microservices with Project Tye.
- Sam Walpole shows off Automapper, Mediatr, Swagger, and Fluent Validation.
- Charles Flatt writes about interesting behaviors with NuGet 5.7+.
- John Reilly prettifies C# with dotnet-format and lint-staged.
- Scott Hanselman provides a 2021 update for his Developer and Power Users Tool List for Windows.
đ Security
- Giorgi Dalakishvili uses WebAuthn with C#.
- Gergely Sinka supports .NET Core SameSite + OAuth apps on Linux.
- Andrea Chiarelli uses C# extension methods for Auth0 authentication.
đ Design, architecture, and testing
- Derek Comartin scales a monolith horizontally.
- Steve Smith writes about data-deficient messages.
- Pavel Krymets unit tests and mocks with the Azure .NET SDK.
- Sean Killeen utilizes the Bogus library for better mocks.
- Kevin Avignon writes about guidelines to improve your .NET software design skills.
đ± Xamarin
- Charlin Agramonte writes about multi-binding in Xamarin Forms.
- James Montemagno introduces a cadence sensor display for iOS.
- Leomaris Reyes debugs on a real Android device using Xamarin for Visual Studio and also replicates a Christmas shopping UI.
- Suthahar deploys Xamarin.iOS app to iOS devices without an Apple Developer account and also works with emotion recognition in Xamarin.
đ€ Podcasts
- .NET Rocks builds a flight simulator in C# with Laura Laban, and talks to Scott Hunter about .NET 5.
- The 6-Figure Developer Podcast talks to Dave Glick about Statiq and open source, and talks about REST with Irina Scurtu.
- The Azure DevOps Podcast talks to Maddy Leger about Xamarin in a .NET 5 world, and talks with Kendra Havens about Codespaces.
đ„ Videos
- Gerald Versluis accesses battery and energy saver info with Xamarin.Essentials.
- The Loosely Coupled Show talks with Fran MĂ©ndez about AsyncAPI.
- At Technology and Friends, David Giard talks to Ed Charbeneau about Blazor testing.
- David Ortinau validates navigation in Xamarin.Forms, and also adds a header to the flyout menu in Xamarin.
- Jeremy Likness and Arthur Vickers give a tour of EF Core 5 in two videos.
Top comments (0)