27 May 2026
Functional Programming in C# 15: Union Types and the ApiResult Monad
- A union type is a type that holds exactly one of several named cases at a time.
- Think of a monad as a smart wrapper around a value that lets you chain operations without checking for errors at every step. The wrapper carries the result or the failure through the pipeline — you only inspect the outcome at the end.
- We can define an
ApiResult<T>union type that can be one of exactly one of these cases:
1
2
3
4
5
6
7
8
9
public record Success<T>(T Data);
public record HttpError(int StatusCode, string Message);
public record TransportError(Exception Exception);
public readonly union ApiResult<T>(
Success<T> success,
HttpError httpError,
TransportError transportLevelError
);
Every ApiResult
Removing byte[] allocations in .NET Framework using ReadOnlySpan<T>
The normal use for Span is creating segments of a string by using AsSpan instead of Substring.
The rest of the article goes on to explain a compiler optimization for read-only bytes by using a ReadOnlySpan<byte>.
Architectural Tests in .NET
Another article about architectural testing, using ArchUnitNET and some others.
BSides Amsterdam 2025
YouTube videos of the talks from BSides security conference in Amsterdam.
Ten Months with Copilot Coding Agent in dotnet/runtime
Microsoft dogfooding CCA to create PRs to fix issues in the dotnet runtime. It gives lots of numbers about how many PRs were fixed, how many comments were needed to guide it, etc. It describes what kind of tasks CCA is good at, and what it struggles with.
Recently there’s been a bit of pushback against AI generating low quality, buggy code. This article didn’t really talk about that - it kinda implies that if the reviewer thinks it’s okay then it must be okay.
IAM: Everything You Need to Know
This really is everything you need to know - not too much, not too little. It explains IAM platforms (Auth0, Entra Id, etc), Identity Providers (Google, Facebook, etc), tokens and how to use and store them (access token, refresh token, ID token).
Passkeys 101: An Introduction to Passkeys and How They Work
Considerably simpler than OAuth!
How The Heck Does GPS Work?
Really nice, understandable explanation of how GPS works. How all the bit of science and math fit together.
Email is crazy
A simple explanation of how email works, and the hacks that have been added to it to make it a bit better.
IAsyncEnumerable<T> in C#: Streaming Data Without Loading Everything into Memory
IAsyncEnumerable<T> lets you stream data asynchronously.
If you expect a large data set then it’s better to use .AsAsyncEnumerable() instead of .ToListAsync() to avoid loading the full collection into memory.
Very useful article with a few use cases, and a few gotchas:
- Forgetting CancellationToken
- Buffering with ToListAsync()
- Disposing Resources Too Early
- Not Configuring DbContext Lifetime
- Ignoring Transaction Timeouts
Understanding IHostedService & BackgroundService in .NET 10
IHostedService has two methods StartAsync and StopAsync which run when your app is starting and stopping.
The host waits for these methods to complete before it continues starting or stopping the app.
If you want to run some initialization code when the app starts,
such as seeding a database, or warming up a cache,
then you can implement IHostedService and put that code in StartAsync.
If you want to run a background task continuously while the app is running,
you can implement BackgroundService which is a base class that implements IHostedService and provides
ExecuteAsync where you can put your background logic.
There are 5 important gotchas mentioned:
- An Unhandled Exception in ExecuteAsync Can Crash the Entire Host
- Injecting Scoped Services Into a BackgroundService (Captive Dependency)
- ExecuteAsync Returning Early Silently Kills the Service Forever
- Ignoring stoppingToken Slows Shutdown and Abandons In-Flight Work
- Heavy CPU Work in ExecuteAsync Starves the Thread Pool
Why Japanese companies do so many different things
And finally, a non-technical article about why Japanese companies are so diversified. Basically, it’s because the whole social structure of Japanese companies is differently motivated than elsewhere. The companies work to continue to exist, not to provide value to shareholders. The workforce is employed for life, and are rewarded according to the company’s success, not their individual performance. The article talks about the Japanese “bundle” - no one difference makes the success, but the entire bundle of differences feeds off each other. For example, since employees stay for life, it’s worthwhile to invest in more extensive training; since employees are rewarded according to the company’s success, workers are more motivated to work together and support each other. All of this enables diversification to work.
Bringing it back to tech, the famous Toyota andon cord, where any worker can pull the cord to stop the production line if they see a problem, works because everyone understand the problem and can work together to a solution.
