.NET Tools
Essential productivity kit for .NET and game developers
.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.
.NET news
- 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
Featured content
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 Task.Delay
or 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_in_the_past_are_invalid
or 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.
- JavaScript unit testing frameworks in 2022: A comparison – Here’s a nice rundown of popular JS testing frameworks, and their features. Post by Mohsen Taleb.
- The 10 Immutable Laws of Testing – Peter Vogel has blogged about the important things that you need to keep in mind when doing tests.
Fun tweets….
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!):
JetBrains .NET Days Online
JetBrains .NET GameDev Day Online
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
Don’t miss this fantastic offer! CODE Magazine is offering a free subscription to JetBrains customers. Get your copy today!
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!