Most REST API bugs are mundane. A mobile app on a weak connection retries a POST, and the customer ends up with two orders. An endpoint returns 200 OK with “success”: false in the body, so every client has to parse a message string to learn that something failed. Someone renames a JSON field on …
.Net Core
ASP.NET Core Best Practices: A Performance Quick Reference
ASP.NET Core is fast by default, and most of the slowdowns in real apps trace back to a handful of habits: blocking on async code, loading too much data in one go, and putting heavy work on code that runs for every request. This post collects those ASP.NET Core best practices in one place, along …
SP.NET Core, React and Database Security Best Practices
This is the security checklist I go through on the stacks I’ve used most as a developer: ASP.NET Core and .NET, REST APIs, React and npm, and SQL and NoSQL databases. Each section is short enough to skim before a release or a code review. Where the right setting isn’t obvious, there’s a small code …
Entity Framework Core and LINQ Best Practices for C#
Entity Framework makes data access easy to write, and that’s also what makes it easy to write badly. A query that’s instant against a few test rows can bring the database to a crawl once it hits production data, and the C# often looks perfectly fine. This is my reference list of LINQ and Entity …
C# Async and Parallel Programming Best Practices
I’ve written about asynchronous and parallel programming before, in the seven most common async mistakes and what SynchronizationContext is. Few topics in C# produce as many subtle bugs. Deadlocks only show up on the UI thread, exceptions disappear from async void methods, and race conditions never happen on your machine and happen every day in …
Sharing Clients in Duende IdentityServer: Security Risks
Years ago I built authorization on the open-source IdentityServer4 (I wrote about that here). Its successor, Duende IdentityServer, is a commercial product, and its pricing depends on how many clients you configure. For a company that ships its software for customers to install on their own servers, instead of running it as SaaS, there’s also …
How to Customize Windows Terminal and PowerShell Using Fzf, Neovim and Beautify it with Oh My Posh
PowerShell on its own it a very powerful tool. But what if told you can make it even better using some tools that you can install on it? Not only that but you can also make it more beautiful/handsome, perhaps with a bit of a personal touch too? So, in this post I’m going to …
Integration Test In Asp.Net Core 6 Using SqlServer Image and TestContainers
This post is about writing integration tests and TestContainers. As you might know writing integration tests against the in-memory provider is a bad practice. Because it only works well with trivial solutions. Mostly because the in-memory API of IQueryProvider doesn’t match the LINQ query provider. Here’s a good article called “Avoid In-Memory Databases for Tests” …
Unable to locate the .NET SDK: The Reasons
The other day after installing some windows update, I tried to open Visual Studio. I opened my project and I received an error regarding .Net Sdk. The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed …
Enum Serialization: System.Text.Json vs Utf8Json vs Jil vs Newtonsoft
I was reading about the new System.Text.Json in .net core 3 and comparing its speed to other libraries. You can read more about it here if you’re interested. To put it shortly, the new serializer is faster then Newtonsoft but not as fast as others. Also the enum serialization between different libraries can be inconsistent. …
