Course · 28 lessons

Async .NET

Await results, compose tasks, handle failures, and cooperate with cancellation.

  1. A task represents completion

    Await a result without treating a task as a thread.

    Core ideas · 10 min
  2. Sequential dependencies

    Await one step before starting work that needs its result.

    Core ideas · 10 min
  3. Independent tasks and WhenAll

    Start independent operations before awaiting their combined result.

    Core ideas · 10 min
  4. Observing async failures

    Catch an expected failure around the await that observes it.

    Core ideas · 10 min
  5. Passing cancellation

    Let the caller own the decision to stop an operation.

    Working with data · 10 min
  6. Cancelling an awaited timer

    Use a cancellable API instead of polling shared flags.

    Working with data · 10 min
  7. Finally and ownership

    Run cleanup after asynchronous success or failure.

    Working with data · 10 min
  8. Completed tasks

    Return an existing result without inventing asynchronous work.

    Working with data · 10 min
  9. Asynchronous streams

    Consume values as an async producer makes them available.

    Putting it together · 10 min
  10. Race a completion

    Observe which operation completes without losing the remaining work.

    Putting it together · 10 min
  11. Bounded batches

    Limit outstanding work instead of starting every task at once.

    Putting it together · 10 min
  12. Async composition with results

    Keep validation synchronous and waiting asynchronous.

    Putting it together · 10 min
  13. Execution before the first incomplete await

    Observe exactly when an async method gives control back to its caller.

    Deeper practice · 18 min
  14. Synchronous guards and faulted tasks

    Distinguish a rejected call from a task that represents a failed operation.

    Deeper practice · 18 min
  15. Inspecting all failures from WhenAll

    Await the group and retain its aggregate diagnostic information.

    Deeper practice · 18 min
  16. WhenAny returns a winner that may have failed

    Observe the winning task rather than treating race completion as operation success.

    Deeper practice · 18 min
  17. Canceling a wait without canceling its operation

    Keep the original task when a caller stops waiting early.

    Deeper practice · 18 min
  18. Linked tokens combine cancellation owners

    Allow either parent lifetime to request cooperative cancellation.

    Deeper practice · 18 min
  19. Canceled tasks are distinct from faulted tasks

    Inspect terminal states without treating cooperative cancellation as an ordinary error.

    Deeper practice · 18 min
  20. Timeouts and caller cancellation are different outcomes

    Use a timeout for the wait without pretending the underlying operation stopped.

    Deeper practice · 18 min
  21. Bounded async access with SemaphoreSlim

    Limit active operations without blocking a thread for each waiting task.

    Applied techniques · 18 min
  22. TaskCompletionSource bridges a completion signal

    Represent one externally supplied result and reject duplicate completion safely.

    Applied techniques · 18 min
  23. ValueTask for a frequently synchronous result

    Understand the consumption contract before choosing a lower-allocation return shape.

    Applied techniques · 18 min
  24. Asynchronous disposal with await using

    Await cleanup before the owning scope reports completion.

    Applied techniques · 18 min
  25. Cancellation through async enumeration

    Pass a consumer token into an async iterator and stop between elements.

    Applied techniques · 18 min
  26. Progress is a reporting contract

    Report intermediate state without confusing it with the final result.

    Applied techniques · 18 min
  27. Bounded retries for explicitly transient failures

    Retry a narrow failure category while keeping attempt limits visible.

    Applied techniques · 18 min
  28. Sharing one cached asynchronous operation

    Cache the task when callers should observe the same in-flight work.

    Applied techniques · 18 min