use-cancellation-tokens

Installation
SKILL.md

Use Cancellation Tokens in ABP

Prefer an explicit CancellationToken parameter at public async boundaries and pass it through every cancellable call. Use ICancellationTokenProvider when ABP ambient cancellation must reach code that does not receive a token directly.

When to Use

  • Propagate an incoming token through application services, repositories, EF Core, MongoDB, HTTP calls, and stream operations.
  • Use the current ASP.NET Core request's HttpContext.RequestAborted token indirectly.
  • Add cancellation to custom code that is called through ABP infrastructure without an explicit token.
  • Temporarily override the ambient token for a scoped operation or test.

When Not to Use

  • Configure background job workers, retries, or event processing — use background-jobs-and-events.
  • Treat cancellation as an async performance fix — cancellation is cooperative control flow, not parallelism.
  • Configure HTTP authentication — use configure-openiddict-authentication.

How it works

Installs
22
GitHub Stars
32
First Seen
Aug 15, 2026