Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
19 posts found #async
Exceptions in C# Async: AggregateException and Errors in WhenAll
Backend PART 05

Exceptions in C# Async: AggregateException and Errors in WhenAll

An exception in an async method goes into the task and is thrown with its original type at the await. Throwing parameter checks at the call, the difference between Wait, GetResult and await, reaching every error and partial results from WhenAll, an error order that differs between two overloads, AggregateException.Handle and unobserved task exceptions.

7 Nov 2026 9 min 4
How C# async/await Works: The State Machine and Continuations
Backend PART 04

How C# async/await Works: The State Machine and Continuations

await does not always wait: on a finished task the code continues on the same thread. What the async keyword actually does, the GetAwaiter/IsCompleted/OnCompleted steps, a working hand-written state machine, looking at the compiler-generated type with reflection (a class in Debug, a struct in Release), which thread runs the continuation, and the awaitable pattern.

7 Nov 2026 10 min 3
C# Task and Task<T>: A Promise That Starts Hot
Backend PART 03

C# Task and Task<T>: A Promise That Starts Hot

An async method starts running the moment it is called; await does not start work, it waits for its result. The task life cycle and Status values, creating tasks with Task.FromResult and TaskCompletionSource, awaiting the same task twice, starting work first and awaiting later, and the Task<Task> trap of Task.Factory.StartNew.

7 Nov 2026 10 min 5
C# Threads and the ThreadPool: A Short History of Async from APM and EAP to TPL
Backend PART 02

C# Threads and the ThreadPool: A Short History of Async from APM and EAP to TPL

Foreground versus background threads, why the Thread class cannot carry results or errors, and a real measurement of 1000 threads against the thread pool. Then .NET's road to async: APM's Begin/End pair, EAP's Completed event, TPL's Task and the async/await that arrived with C# 5.

7 Nov 2026 10 min 3
Why Async Exists in C#: Blocking, I/O and Scale
Backend PART 01

Why Async Exists in C#: Blocking, I/O and Scale

The same 100 stock queries finish in one second with async and in 8-9 seconds with code that blocks the thread. The difference between I/O-bound and CPU-bound work, what blocking costs in a UI and on a server, thread pool starvation, why async buys capacity rather than speed, and the fake async trap.

7 Nov 2026 9 min 10
Async and Connection Management in Dapper: CancellationToken, Pooling and DI
Database PART 06

Async and Connection Management in Dapper: CancellationToken, Pooling and DI

We see with real output why a CancellationToken only travels through CommandDefinition in Dapper, why async on SQLite actually runs synchronously, how connection pooling helps, why sharing one connection breaks, and the connection factory pattern in ASP.NET Core.

6 Nov 2026 11 min 12
Advanced JavaScript Async Patterns: The Promise.all Family, Cancellation, Retry and Timeouts
Frontend PART 05

Advanced JavaScript Async Patterns: The Promise.all Family, Cancellation, Retry and Timeouts

We look at the differences between Promise.all, allSettled, any and race, ES2024's Promise.withResolvers, ES2025's Promise.try, supporting AbortSignal in your own functions, retry, timeouts and concurrency limits.

3 Nov 2026 9 min 27
Blog Map