.NET Annotated Monthly | November 2022
Did you know? When C# was introduced in 2000, it came with a language construct called “delegate”. It’s kind of a lost art, but it still is a great alternative to interfaces to make code more testable. Whenever a particular delegate is expected, it also accepts a method with the same signature, or a lambda.
- Announcing .NET MAUI support for .NET 7 Release Candidate 2
- What’s new in System.Text.Json in .NET 7
- Announcing .NET MAUI support for Xcode 14 and iOS 16
- Announcing Entity Framework Core 7 RC2: JSON Columns
- Announcing .NET 7 Release Candidate 2
- ASP.NET Core updates in .NET 7 Release Candidate 2
- Announcing the .NET MAUI Community Toolkit v1.3
We’d like to thank Dennis Doomen for curating this month’s featured content! Dennis is a veteran architect in the .NET space with a special interest in writing clean code, Domain Driven Design, Event Sourcing and everything agile. He is the author of Fluent Assertions, a very popular .NET assertion framework, Liquid Projections, a set of building blocks for building .NET applications based on Event Sourcing and he has been maintaining coding guidelines for C# since 2001. He also keeps a blog on his everlasting quest for better solutions. You can reach Dennis on twitter through @ddoomen.
Event Sourcing, the architecture style that goes hand-in-hand with the Command Query Responsibility Segregation pattern is becoming more mainstream every day. But it doesn’t mean everybody knows what it can do for you and what kind of problems it can help you solve. Check out this recent blog post to learn about 10 scenarios where this architecture style can help you.
Writing code without writing tests is like driving without seatbelts and Rider is an awesome IDE to get the most out of Test Driven Development. But finding the right scope of testing, the so-called “unit” isn’t always easy. I strongly believe that the text-book example of treating every class as the unit is almost always wrong. Check out some heuristics for finding the right scope here or catch me at Update Conference Prague 2022.
And when you’re as heavily invested in automated testing as I am, you must have run into flakiness at some point. This can be caused by relying on static mutable state, using
Thread.Sleep, or when a lot of concurrent (
async) paths are executed. The worst part is that they don’t always appear in a consistent way. Being able to use Rider’s Run/Debug Selected Tests Until Failure can be a huge life-saver.
After a decade of Resharper and a couple of years of using Rider, I started to wonder what it would feel like to work with a vanilla Visual Studio and see how far Microsoft came with that. Well, in the summer of 2020 I tried this for a month or two and I can tell you that this wasn’t fun. You can read about my experiences here. This summer, just to be sure, I ran my experiment again (but this time using Visual Studio 2022). I still have to finish a blog post on this, but I’m afraid to report the situation hasn’t improved.
For a long time I’ve been a fan of naming my automated tests using the convention
When_the_delivery_date_is_in_the_past_it_should_throw. However, I recently ran into an article that completely changed my mind about this. I still want functional test names that capture the expected behavior, but now I’m using something like
Delivery_dates_must_be_in_the_future. In most cases, I don’t need the words should or when anymore.
Programing tutorials and tips
.NET tutorials and tips
- Improve Your XAML Skill by Replicating a Camping App UI in .NET MAUI and Improving Your Desktop Applications With ToolTips in .NET MAUI– Improve your apps this month with these posts by Leomaris Reyes geared towards using MAUI to build apps. Leomaris breaks down replicas of common app styles so that you can learn how to create them.
- Quick fix for SMTP username and password not accepted error – Linda Lawton at DAIMTO Developer Tips published this troubleshooting video. Linda’s gone through many minutes of troubleshooting so you only have only 5 minutes of video watching to get a solution.
- Random Password Generator in C#.NET – Golda at Code Murals made a quick tutorial about a quick action: creating random passwords. Great to get back to basics.
- Introducing the .NET MAUI Autocomplete Control – At this point in mine Autocomplete isn’t just a nice feature to have, but it’s mandatory for any text box where folks type in one to several words. It’s found in all types of software. So checkout this post by Selva Ganapathy Kathiresan on Syncfusion’s new MAUI Autocomplete Control.
- Using WASM and WASI to run .NET 7 on a Raspberry PI Zero 2 W and Write Logseq plugins in WebAssembly using .NET and C# – Laurent Kempé is focusing on WASM and .NET. This new direction in web development aims to bridge the gap between the web and desktop. Read about it here first.
- Adding Experimental HTTP Methods To ASP.NET Core and .NET Class Diagrams In JetBrains Rider with PlantUML – Did you know? There is an `HTTP QUERY` method (experimental, in draft) that behaves a bit like both GET and POST methods? There is, and Khalid Abuhakmeh blogged about how to use it. In addition, learn about using UML inside of Rider with the PlantUML plugin.
- Adding validation to strongly typed configuration objects in .NET 6 and Adding validation to strongly typed configuration objects using FluentValidation– Validation is this month’s topic by Andrew Lock. Andrew explains how you can bind a strongly typed configuration to an object at runtime, but also avoid IOptions (and why) if necessary. In another post, Andrew ties in using FluentValidation to the configuration code.
- LiteDB – A .NET embedded NoSQL database and Low-level struct improvements in C# 11 – Here’s two by Steven Giesel: The first shows off LiteDB. LiteDB is a “.NET NoSQL Document Store in a single data file”. The next describes some under the hood specifics in C# – particularly Span<T>, struct, and `ref struct` perform across a few .NET versions.
- Rate limiting in web applications – Concepts and approaches – When traffic to your website or becomes volatile or surges, what do you do? This post by Maarten Balliauw has some great advice as to how to deal with this unexpected traffic with rate limiting (aka request throttling).
- Handling Custom 404 Page on GH Pages with Blazor WASM – <Insert joke about HTTP 404: Can’t Find Blog Post> then read this to learn how to implement a custom 404 page when you’ve deployed a Blazor WASM app to GitHub pages. Post by Justin Yoo.
- Build the modular monolith first – Chris Klug asks us to think first before choosing a software architecture. Don’t just go with the popular thing (in this case, microservices). Consider building the monolith as usual, then refactor some of it into microservices.
- How to generate header images for blogs and ASP.NET Core – This is a handy tutorial by Thomas Ardal, for those who blog or run a CMS.
- Storing values in the Secrets Manager Tool – Bruno Sonnino shares the secrets to storing values in the Secrets Manager tool.
- Boosting Performance With Sealed Classes in .NET – Most folks don’t even consider that OOP techniques could indeed help your code perform better. In this case, it’s telling the compiler that a class is sealed, so that code can’t further derive from it. Marko Hrnčić explains how it all works in this post.
- Performance Testing of ASP.NET Core APIs With k6 – Ryan Miranda demonstrates perf testing with K6 in ASP.NET Core.
- Performance gains when specifying a List’s capacity – Another performance boost is specifying the capacity of `List` and other objects. Henrique Dalcin Dalmas pens the details.
- Functional Programming in C#—A Brief Consideration – Assis Zang shows how to put the fun in functional programming by making the case for it in C#.
- ASP.NET Core: Three(+1) ways to refresh the claims of a logged-in user – Jon P. Smith reviews these ways to refresh the login.
- How to Build a Url Shorter with C# Minimal APIs and Azure – John Kilmister shows us how to write a URL shortener, but with Minimal APIs and Azure.
Related programming tutorials and tips:
- To Tailwind or Not To Tailwind—That is the Question – Alyssa Nicoll reviews the pros and cons of this popular CSS framework. What do you think?
- What is Software Architecture? – What a great question! Do you think about what software architecture really is? It’s more than just putting together assets in a structured way. You must think about things like coupling and cohesion. Derek Comartin breaks it all down.
- Keep your source control history clean with fixup commits – From the archives, Dennis Doomen reviews what you need to know about clean history – fixup commits are like refactoring.
- The 10 Immutable Laws of Testing – Peter Vogel has blogged about the important things that you need to keep in mind when doing tests.
Can you explain a loop as well as this kid can?
Interesting and cool stuff
- Two heads are better than one: What second brains say about how developers work – This sci-fi style post is a great piece by Eira May discussing how we can outsource brain power to technology and what makes developer brains tick.
- The many strengths of neurodivergence (Ep. 493) – Having different perspectives because people come from different backgrounds builds better products. Teams can take the best ideas and tricks that otherwise are unavailable without diverse members. Ben Popper interviews Ceora, Wesley Faulkner, and Mariann Lowery on neurodivergence in tech.
- Milestone Reached: 200+ Free Ebooks Are Now Available in the Succinctly Series – Who doesn’t love a free Ebook? Get em now, from Succinctly!
And finally, the latest from JetBrains
Here’s a chance to catch up on JetBrains news that you might have missed:
Recordings are available at JetBrains TV (don’t forget to like and subscribe!):
Check out our .NET Guide! It’s a learning tool with tons of videos, tips, tricks, and info on a variety of .NET related topics.
Blog posts, webinars, etc..:
- Case Study – How Profilers Point Out Heisenbugs
- Rider 2022.3 EAP 2: New UI, Improved Unit Testing, Better Dynamic Program Analysis and More.
- Webinar – Wolverine: Your Next Messaging Library
- RiderFlow 2022.1.4 Bug-Fix Update
Sharing is caring! So share content that you find useful with other readers. Don’t keep it to yourself! Send us an email with your suggestions for publication in future newsletters!
Subscribe to Blog updates
Thanks, we've got you!
.NET Annotated Monthly | December 2023
Did you know? The acronym ASP in ASP.NET stands for “Active Server Pages”. Before ASP.NET was released in 2002, ASP (just ASP, not ASP.NET) is how developers wrote websites on the Microsoft stack. It was a very basic model of server side rendering. Today, there are many ASP.NET products for buildin…
dotCover, dotMemory, dotPeek, and dotTrace 2023.3 Release
dotCover 2023.3, dotMemory 2023.3, dotPeek 2023.3, and dotTrace 2023.3 have been released and are ready for download! Let’s take a look at what’s new with these .NET tools. dotMemory 2023.3 dotMemory Standalone is now available on Linux and macOS. dotMemor…
ReSharper 2023.3: Support For C# 12, Performance Enhancements, and More AI-Powered Features
ReSharper 2023.3 and new versions of other JetBrains .NET tools have just been released. This version brings support for the latest C# 12 features, optimized background code analysis, and the ability to control the amount of resources allocated to solution-wide code analysis. AI Assistant has also r…
Rider 2023.3: Support for .NET 8 SDK, the Latest From C# 12, Performance Enhancements, Predictive Debugging, and More AI-powered Features.
A major update for Rider has just been published! Rider 2023.3 offers support for the .NET 8 SDK, including the latest features from C# 12. Other enhancements include an improved experience when running multiple projects, a predictive debugging mode, and the ability to easily create and navigate thr…