dotnet / dotnet/docs

Failure to dispose CancellationToken in "How To: Listen for Multiple Cancellation Requests"

Open
#25,294 0 comments 0 reactions 0 assignees View on GitHub
dotnet-fundamentals/svc okr-quality
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

It seems as though `WorkerWithTimer.internalToken` is never disposed in this example code. My understanding is that `CancellationTokens` needs to be disposed? Generally speaking this is something that could be spelled out more explicitly in `CancellationToken` docs.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 073f1486-9fa6-a17c-d649-d4ae5a36b8d8
* Version Independent ID: 55cc3625-d0a5-3422-0d27-945823a0c64b
* Content: [How to: Listen for Multiple Cancellation Requests](https://docs.microsoft.com/en-us/dotnet/standard/threading/how-to-listen-for-multiple-cancellation-requests)
* Content Source: [docs/standard/threading/how-to-listen-for-multiple-cancellation-requests.md](https://github.com/dotnet/docs/blob/main/docs/standard/threading/how-to-listen-for-multiple-cancellation-requests.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @BillWagner
* Microsoft Alias: **wiwagn**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.