Skip to content

Use CancellationToken.None for cleanup in .NET cancellation example#4446

Open
donald-pinckney wants to merge 1 commit intomainfrom
cancellation_token_none
Open

Use CancellationToken.None for cleanup in .NET cancellation example#4446
donald-pinckney wants to merge 1 commit intomainfrom
cancellation_token_none

Conversation

@donald-pinckney
Copy link
Copy Markdown

@donald-pinckney donald-pinckney commented Apr 17, 2026

Summary

  • The .NET cancellation example creates an inert CancellationTokenSource just to get a non-cancelled token for the cleanup activity. CancellationToken.None is the idiomatic no-op for this case.
  • Added a comment explaining why CancellationToken.None is used, and when a new detached CancellationTokenSource would actually be appropriate (e.g. if cleanup itself needs to be cancellable from a timeout or signal).

Context

This was discovered during code review of the skill for .NET (which lifted the example from the docs).

🤖 Generated with Claude Code

┆Attachments: EDU-6217 Use CancellationToken.None for cleanup in .NET cancellation example

Creating an inert CancellationTokenSource just to get a non-cancelled
token is misleading — CancellationToken.None is the idiomatic no-op.
Also add a note explaining when a new detached CancellationTokenSource
would actually be appropriate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@donald-pinckney donald-pinckney requested a review from a team as a code owner April 17, 2026 15:37
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment Apr 17, 2026 3:38pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant