Add simple parent-child linked cancellation token example#52330
Open
Add simple parent-child linked cancellation token example#52330
Conversation
Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add simple example for creating parent-child tokens
Add simple parent-child linked cancellation token example
Mar 17, 2026
BillWagner
approved these changes
Mar 17, 2026
Member
BillWagner
left a comment
There was a problem hiding this comment.
This is ready for final review.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Cancellation in Managed Threads documentation to include a minimal parent-child linked cancellation token example using CancellationTokenSource.CreateLinkedTokenSource, supported by new self-contained C# and Visual Basic snippet projects.
Changes:
- Added new C# and VB console snippet projects demonstrating a simple parent→child linked token pattern.
- Restructured the “Listening to multiple tokens simultaneously” section to lead with the new simple example before the existing more complex scenario.
- Updated article frontmatter (
ms.date, andai-usage).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/Program.cs | Adds the minimal C# linked-token example used by the article. |
| docs/standard/threading/snippets/cancellation-in-managed-threads/csharp/LinkedTokens/LinkedTokens.csproj | Adds a self-contained C# console project to build/run the snippet. |
| docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/Program.vb | Adds the minimal VB linked-token example used by the article. |
| docs/standard/threading/snippets/cancellation-in-managed-threads/vb/LinkedTokens/LinkedTokens.vbproj | Adds a self-contained VB console project to build/run the snippet. |
| docs/standard/threading/cancellation-in-managed-threads.md | Reorders and expands the linked-token section, and embeds the new snippets. |
Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
BillWagner
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "Cancellation in Managed Threads" article lacked a basic example of
CreateLinkedTokenSourcefor the parent-child pattern — the most common reason developers reach for linked tokens.Changes
docs/standard/threading/snippets/cancellation-in-managed-threads/{csharp,vb}/LinkedTokens/): self-contained C# and VB console projects demonstrating the minimal parent-child patterncancellation-in-managed-threads.md): restructured "Listening to multiple tokens simultaneously" to lead with the simple example before the existing complex class-based scenario; updatedms.dateand addedai-usage: ai-assistedOriginal prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.
Internal previews