by Jonathan Bright | Nov 4, 2026 | Tutorials
A game can receive a valid command at the wrong time: Start after a win, Win before play begins, or Restart while playing. A small state machine makes those decisions explicit. Here we build a console-only reducer that returns the next state from the current state and...
by Jonathan Bright | Nov 4, 2026 | Tutorials
To limit a batch to three asynchronous operations in flight, share one SemaphoreSlim(3, 3) across the batch. Await a permit before starting the operation, and release it in finally after the operation finishes. A canceled wait has acquired nothing, so it must not...
by Jonathan Bright | Nov 4, 2026 | Tutorials
A dashboard can load a profile, prices, and stock independently. If two lookups fail, logging only the exception caught around await Task.WhenAll(…) can hide part of the incident. A successful stock lookup can still be useful, provided the application explicitly...
by Jonathan Bright | Nov 3, 2026 | Tutorials
A method can accept a CancellationToken and still ignore cancellation if it fails to pass that token to the next layer. Trace the whole path: caller, handler, service, repository, and the operation that actually waits. This tutorial deliberately drops a token at a...
by Jonathan Bright | Nov 2, 2026 | Tutorials
A slow request does not tell you whether work is waiting for a free worker or waiting on a dependency that can never complete. Diagnose the missing resource before changing thread counts. This tutorial compares both failures with bounded C# console programs. Verified...
by Jonathan Bright | Nov 1, 2026 | Tutorials
Two threads can stop each other when one holds the left lock and needs the right, while the other holds the right and needs the left. Fix this acquisition cycle by making every operation take the locks in one consistent order, even when the operation moves data in the...