The .NET Stacks #48: ⚡ Sockets. Sockets everywhere.
What is Azure Web PubSub, and how is it different than SignalR?
NOTE: This is the web version of my weekly newsletter, which was released on May 08, 2021. To get the issues right away, subscribe at dotnetstacks.com or at the bottom of this post.
Happy Monday! Here’s what we’re talking about this week:
- One big thing: Microsoft announces Azure Web PubSub
- The little thing: Logging middleware coming, new try-convert release, and EF perf improvements
- Last week in the .NET world
Microsoft announces Azure Web PubSub
Here’s what’s on our minds: how is this different than the SignalR service? While both services are internally built from similar tech, the most significant difference is that there’s no client or protocol requirement with Azure Web PubSub. You can bring your WebSocket library if you wish. And also, unlike SignalR, you’re just working with WebSockets here—you won’t see automatic reconnect scenarios, long polling, and whatnot.
What does this mean for SignalR? Nothing. As a matter of fact, according to David Fowler, here’s when you’d want to stick with SignalR:
- You’re a .NET-specialized dev shop and have SignalR client libraries and expertise
- You need fallbacks other than WebSockets, like long polling or server-sent events
- The existing SignalR client platforms work for you
- You don’t want to manage a custom protocol and need more complex patterns (and want SignalR to manage it for you)
- You don’t want to manage the reconnect logic yourself
Anthony Chu sums it up pretty well when he says:
Personally, I would use SignalR unless you need to support clients that don’t have a supported SignalR library. You could write the code connect/reconnect/messaging code yourself but SignalR does it all for you with a nice API.
Speaking of WebSockets, WebSocket compression is coming to .NET 6 thanks to a community contribution from Ivan Zlatanov. It’s an opt-in feature, and it looks like Blazor won’t be using it for now. Security problems can arise when server messages contain payloads from users and, as a result, shouldn’t be compressed.
The little things: Logging middleware coming, new try-convert release, and EF perf improvements
As we discussed last week, .NET 6 Preview 4 will be a big release with lightweight APIs and AOT on the list (if not more). For Preview 5, ASP.NET Core will be introducing logging middleware. Logging request and response information isn’t the most fun, so middleware will do a lot of the heavy lifting for you (and you can extend it if needed). By default, the logging middleware won’t log response bodies, but that should be a configuration detail. This is a problem every ASP.NET developer has to deal with, so it’s nice to see it being generalized.
A new try-convert release was shipped last week. This release includes enhancements for VB.NET Windows Forms conversions. The new, snazzy .NET Upgrade Assistant relies on this try-convert tool, which means VB.NET WinForms support has arrived with the Upgrade Assistant. That’s all I’m going to say about that because the more you talk about VB.NET, the more someone calls you an expert.
I missed this last week, but the Entity Framework team announced the results from new TechEmpower benchmarks. It looks like EF Core 6 is 33% faster than EF Core 5, and EF Core is also almost 94% of the Dapper performance.
🌎 Last week in the .NET world
🔥 The Top 3
- Brian Lagunas walks through yield return in C#.
- Giorgi Dalakishvili introduces GraphQLinq, a LINQ-to-GraphQL library.
- Microsoft announces Azure Web PubSub.
- Microsoft announces that .NET Framework 4.5.2, 4.6, 4.6.1 will reach End of Support on April 26, 2022.
- Asia Rudenko introduces ReSharper 2021.1.2 and Rider 2021.1.2.
- Uno writes about Uno Platform 3.7.
- Alexandra Kolesova writes how ReSharper and Rider 2021.2 will require .NET Framework 4.7.2 or newer installed on Windows.
📅 Community and events
- The Azure SDK wants your feedback on the next phase of the Azure SDK.
- Alberto Gimeno writes how GitHub uses feature flags.
- Microsoft Build registration is now open.
- Maarten Balliauw comments on ReSharper and Visual Studio 2022 64-bit.
- For community standups: ASP.NET talks about SPA updates and Machine Learning talks about .NET Notebooks and .NET Interactive.
- The .NET Docs Show talks to Irina Scurtu about versioning APIs.
🌎 Web development
- Jeremy Likness works on multi-tenancy with EF Core in Blazor Server apps.
- Damien Bowden secures an ASP.NET Core app and Web API using Windows auth.
- Claudio Bernasconi works on Blazor form handling and input validation .
- Marinko Spasojevic works on Blazor material form creation with file uploads and dialogs.
- Daniel Jiminez Garcia uses Blazor WebAssembly, SignalR and C# 9 to create Full-stack Real-time Applications.
- Cody Merritt Anhorn works with the IntersectionObserver API in Blazor.
- Khalid Abuhakmeh accesses background services from ASP.NET Core.
- Waqas Anwar supports multiple versions of ASP.NET Core Web API.
🥅 The .NET platform
- Nick Randolph explains why he doesn’t want or need WinUI for UWP.
- Matthew MacDonald writes about a lack of Linux support for .NET 6 desktop apps.
- Sam Walpole warns against deferred execution in LINQ.
- Maarten Balliauw investigates a crashing devenv.exe.
⛅ The cloud
- Matias Quaranta writes about improving your Azure Cosmos DB .NET SDK initialization.
- Carlos Souza compares deploying containers in Azure and AWS.
- Jessica Deen refactors for microservices using Linux and Windows containers.
- Jamie Maguire works on aspect-based sentiment analysis with Azure Cognitive Services Text Analytics.
- Damir Arh discusses nullable reference type best practices.
- Jonathan Allen walks through .NET 6 LINQ improvements.
- Khalid Abuhakmeh reads and writes Excel spreadsheets in C#.
- Tom Deseyn completes his series on C# 9 features.
- Billy Griffin writes about GitHub Desktop updates.
- Davide Bellone works with FluentValidation.
- Dave Brock makes microservices fun again with Dapr.
- Andrew Lock tries out the open-source eCommerce platform nopCommerce using Docker.
- Rory Primrose revisits NSubstitute and FluentAssertions.
- Peter Vogel writes about strategy and tools for APIs.
- Leomaris Reyes replicates a Book Worm UI in Xamarin Forms.
- Sam Basu provides his weekly MAUI update.
- Matt Lacey writes about Uno Platform and Xamarin.Forms.
🏗 Design, testing, and best practices
- Derek Comartin talks about aggregate design.
- The NDepend blog writes about a Clean Architecture refactoring case study.
- The .NET Core Podcast talks about dependency injection with Steve Collins.
- The Productive C# Podcast discusses the new DateOnly and TimeOnly structs in C#.
- The Azure DevOps Podcast discusses Blazor architecture.
- The Azure Podcast talks about keeping up with Azure.
- The Adventures in .NET podcast talks about interactive C# with VS Code Notebooks.
- The .NET Rocks show talks with Simon Cropp about Verify.
- The Coding Blocks podcast talks about writing great APIs.
- The On .NET Show talks about authentication for serverless apps, init-only setters, default interface methods in C#, and GitHub Codespaces.
- Azure Enablement talks about cloud financial considerations.