dotnet/BenchmarkDotNet
Add CancellationToken support on non-async benchmark runner APIs
Closed
#3,204 opened on Jul 22, 2026
good first issueup-for-grabs
Repository metrics
- Stars
- (11,464 stars)
- PR merge metrics
- (Avg merge 5d 9h) (20 merged PRs in 30d)
Description
Currently BenchmarkDotNet support CancellationToken on Async APIs.
It's also desirable to support CancellationToken on non-async APIs also on BenchmarkSwitcher/BenchmarkRunner.
Expected usage
Use xUnit.v3's TestContext.Current.CancellationToken to run benchmarks.
Without