Skip to content

Plumb CancellationToken through all CLI commands for consistent Ctrl+C/SIGTERM behavior - #56332

Open
baronfel with Copilot wants to merge 10 commits into
mainfrom
copilot/plumb-cancellationtokens-cli-commands
Open

baronfel with Copilot wants to merge 10 commits into
mainfrom
copilot/plumb-cancellationtokens-cli-commands

Conversation

Copilot AI commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

dotnet commands previously had inconsistent cancellation behavior: command actions, deeper package/workload/tool operations, and several pre-action or Native AOT paths either dropped the available token or used CancellationToken.None. This change makes cancellation follow the full CLI process lifecycle and propagate through the command stack.

Highlights

  • Changed CommandBase.Execute() to accept a CancellationToken and updated command implementations and parser registrations throughout the CLI.
  • Added a synchronous cancellable SetAction adapter so System.CommandLine action tokens reach synchronous command handlers without repeated Task.FromResult wrappers.
  • Added ProcessLifecycle.CancellationToken for work outside an action-scoped token and pass it into managed and Native AOT invocation.
  • Centralized Ctrl+C, SIGTERM, and process-exit cancellation in ProcessLifecycle. The first signal requests cooperative cancellation with a two-second forced-exit fallback; a repeated signal retains the operating system's immediate-termination behavior.
  • Disabled System.CommandLine's competing process-termination handler. System.CommandLine transports the lifecycle token, while ProcessLifecycle owns process signals and ProcessReaper owns child-process forwarding and cleanup.
  • Preserved dotnet run signal behavior: while a reaper owns a child, lifecycle cancellation cannot race and kill it first. Ctrl+C remains with the child, SIGTERM is forwarded during process exit, and an unresponsive child is killed after the bounded shutdown window.
  • Removed every production CancellationToken.None use under src/Cli; tests may still pass CancellationToken.None when cancellation is intentionally not under test.

End-to-end propagation

Cancellation is now carried through:

  • Tool, workload, package, restore, solution, build, publish, pack, run, test, store, clean, MSBuild, and SDK-check command paths.
  • NuGet/package download, signature verification, workload manifest and installer operations, retries, and solution/project loading.
  • dotnet new post-action processors and callbacks, including cancellation-aware child-process execution. Post-action cancellation now propagates instead of being converted into an ordinary failure, and the processor API requires callers to supply a token.
  • MTP and VSTest test execution, project-reference post-actions, project-tool lock waits, package completion, command help rendering, build-server shutdown, and virtual file-based builds.
  • Managed child-process execution, external dotnet-* commands, and Native AOT run/test/file execution, including process-tree termination when cooperative cancellation is requested.
  • Tool-search HTTP requests, with caller cancellation linked to the existing request timeout.

RunApiCommand now uses Console.In.ReadLineAsync(cancellationToken), so cancellation interrupts a pending stdin read rather than waiting for another line.

Validation

  • Added focused regression coverage for action token propagation, cancellation exception preservation, post-action and child-process cancellation, tool search, build-server shutdown, virtual project builds, package operations, solution loading, retries, project-tool resolution, and Native AOT paths.
  • Added Unix-only out-of-process coverage for cooperative Ctrl+C/SIGTERM cancellation, forced termination, SIGTERM forwarding to a reaped child, and forced cleanup of a child that ignores SIGTERM. The signal behaviors now run in a dedicated helper executable so MTP's Ctrl+C handler cannot intercept signals intended for ProcessLifecycle.
  • Fixed the branch-related Helix regressions found after the initial push: matching build-server cancellation now propagates regardless of whether cancellation or task completion wins the wait; forwarding helpers retain their historical output shape; and legacy non-cancellable command execution retains blocking output-drain semantics.
  • The focused shutdown cancellation tests pass 10 consecutive runs. The combined shutdown, VSTest artifact post-processing, and verbosity regression selection passes locally. The Unix signal tests build and deploy their helper on Windows and remain OS-skipped until Unix CI.
  • Managed CLI and Native AOT builds pass, and the Native AOT product publishes successfully.
  • A full Native AOT test-host attempt completed 134 tests successfully before the host hit an unrelated existing Debug assertion in SdkRootLocator.AssertMatchesSelfLocation; the full suite therefore was not reported as passing.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
3 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title [WIP] Plumb cancellation tokens through all CLI commands for consistent behavior Plumb CancellationToken through all CLI commands for consistent Ctrl+C/SIGTERM behavior Sep 17, 2026
Copilot AI requested a review from baronfel September 17, 2026 02:15
@baronfel

Copy link
Copy Markdown
Member

@copilot ensure that the AOT-enabled commands also adopt this pattern

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ensure that the AOT-enabled commands also adopt this pattern

Done in dd7d0e9 (short hash may differ after push): AotRunCommand and AotTestCommand now register with the cancellable SetAction((parseResult, cancellationToken) => ...) overload and accept CancellationToken in their Execute methods. MicrosoftTestingPlatformTestCommand.Run also gained a CancellationToken parameter that's threaded in from both the managed (TestCommandParser) and AOT (AotTestCommand) call sites. Verified dotnet-aot.csproj and dotnet-aot.Tests.csproj build cleanly and all dotnet-aot.Tests pass.

@baronfel

Copy link
Copy Markdown
Member

@copilot check that there are no new uses of CancellationToken.None. In addition, new APIs that added a 'default' value for a cancellationToken parameter should not use a default - force the passing of the new parameter instead

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot check that there are no new uses of CancellationToken.None. In addition, new APIs that added a 'default' value for a cancellationToken parameter should not use a default - force the passing o...

Addressed in 3f5b0e1 (short hash may differ after push):

CancellationToken.None audit: confirmed the only new production-code usages are unavoidable — two are inside synchronous System.CommandLine HelpBuilder-style callbacks that receive no token (Parser.cs's DotnetHelpBuilder.Write override, and MicrosoftTestingPlatformTestCommand.Help.cs's custom help layout, which I updated to pass CancellationToken.None explicitly instead of relying on a default), and one is in the native (UnmanagedCallersOnly) AOT entry point (NativeEntryPoint.cs) which runs entirely outside System.CommandLine's InvokeAsync pipeline. All three now have an explanatory comment. Every other new CancellationToken.None occurrence is in test call sites.

= default removal: removed the default from every internal-only API this PR added a CancellationToken parameter to, forcing explicit passing — PostActionDispatcher.Process, DotnetCommandCallbacks's four methods, all the XyzCommand.Run/ForwardToMsbuild static methods (Build/Clean/MSBuild/Pack/Publish/Restore/Run/SdkCheck/Store/Test), AotRunCommand.Execute (both overloads — reordered params so the required token precedes the optional currentDirectory), AotTestCommand.Execute, MicrosoftTestingPlatformTestCommand.Run, ITestHandler.Initialize and its two implementers, all six MSBuildUtility.cs helpers (reordered BuildPerTfmWithDevices similarly), and ProjectConvertCommand.ExecuteAsync. Kept the default only on IPostActionProcessor.Process/PostActionProcessorBase.Process, since that's a genuinely public extensibility interface consumed by third-party template component authors.

Verified all affected projects build cleanly and reran the targeted tests (AotRunCommandTests, DotnetAddPostActionTests/DotnetRestorePostActionTests/DotnetSlnPostActionTests/MSBuildHandlerTests/TestCommandParserTests, PostActionDispatcherTests) — all green.

Comment thread src/Cli/dotnet-aot/NativeEntryPoint.cs Resolved
Comment thread src/Cli/dotnet/Parser.cs Resolved
@baronfel
baronfel marked this pull request as ready for review September 22, 2026 22:31
Copilot AI lite review requested due to automatic review settings September 22, 2026 22:31
@baronfel
baronfel requested a review from a team as a code owner September 22, 2026 22:31
@baronfel
baronfel requested review from a team as code owners September 22, 2026 22:31
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved cancellation paths remain in command, process, and post-action flows.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 15 Medium severity

Open (15)
What changed in this PR

This PR propagates Ctrl+C/SIGTERM cancellation through managed and Native AOT dotnet CLI command paths.

Changes:

  • Adds cancellation-aware command and process execution APIs.
  • Threads tokens through package, workload, tool, MSBuild, test, solution, and template flows.
  • Updates tests and mocks for cancellation-aware contracts.
File Description
test/​Microsoft.TemplateEngine.Cli.UnitTests/​PostActionTests/​AddJsonPropertyPostActionTests.cs Updates post-action tests.
test/​Microsoft.NET.TestFramework/​Commands/​TestCommand.cs Passes cancellation to retry timers.
test/​Microsoft.DotNet.Tools.Tests.ComponentMocks/​ToolPackageDownloaderMock2.cs Updates downloader mock contract.
test/​Microsoft.DotNet.Tools.Tests.ComponentMocks/​ToolPackageDownloaderMock.cs Updates tool mock cancellation.
test/​Microsoft.DotNet.Tools.Tests.ComponentMocks/​MockNuGetPackageDownloader.cs Updates NuGet mock APIs.
test/​Microsoft.DotNet.PackageInstall.Tests/​ToolPackageUninstallerTests.cs Supplies test cancellation tokens.
test/​Microsoft.DotNet.PackageInstall.Tests/​ToolPackageInstallerNugetCacheTests.cs Supplies test cancellation tokens.
test/​Microsoft.DotNet.PackageInstall.Tests/​NuGetPackageInstallerExtractTests.cs Tests cancellation-aware extraction.
test/​Microsoft.DotNet.PackageInstall.Tests/​MockFirstPartyNuGetPackageSigningVerifier.cs Updates signing verifier mock.
test/​Microsoft.DotNet.Cli.Utils.Tests/​CommandTests.cs Tests process termination on cancellation.
test/​Microsoft.DotNet.Cli.Utils.Tests/​BuiltInCommandTests.cs Tests built-in command cancellation.
test/​dotnet.Tests/​ShellShimTests/​ShellShimRepositoryTests.cs Supplies cancellation to shell-shim resolution.
test/​dotnet.Tests/​NuGetPackageDownloaderTests.cs Tests downloader cancellation.
test/​dotnet.Tests/​GivenExponentialRetry.cs Tests retry cancellation.
test/​dotnet.Tests/​CommandTests/​Workload/​Uninstall/​GivenDotnetWorkloadUninstall.cs Updates workload tests.
test/​dotnet.Tests/​CommandTests/​Workload/​Restore/​DiscoverAllProjectsTests.cs Updates solution discovery tests.
test/​dotnet.Tests/​CommandTests/​Workload/​Repair/​GivenDotnetWorkloadRepair.cs Updates workload repair tests.
test/​dotnet.Tests/​CommandTests/​Workload/​List/​GivenWorkloadInstallerAndWorkloadsInstalled.cs Updates workload list tests.
test/​dotnet.Tests/​CommandTests/​Workload/​List/​GivenDotnetWorkloadList.cs Updates workload list tests.
test/​dotnet.Tests/​CommandTests/​Workload/​Install/​WorkloadInstallAspireDeprecationTests.cs Updates workload install tests.
test/​dotnet.Tests/​CommandTests/​Workload/​Install/​WorkloadGarbageCollectionTests.cs Updates garbage-collection tests.
test/​dotnet.Tests/​CommandTests/​Workload/​Install/​MockWorkloadManifestUpdater.cs Updates manifest mock APIs.
test/​dotnet.Tests/​CommandTests/​Workload/​Install/​MockPackWorkloadInstaller.cs Updates installer mock APIs.
test/​dotnet.Tests/​CommandTests/​Workload/​Install/​GivenAFileBasedManifestInstaller.cs Supplies extraction cancellation.
test/​dotnet.Tests/​CommandTests/​Workload/​Install/​FailingNuGetPackageInstaller.cs Updates failing downloader mock.
test/​dotnet.Tests/​CommandTests/​Workload/​Clean/​GivenDotnetWorkloadClean.cs Updates workload clean tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Update/​UpdateToolParserTests.cs Updates tool parser tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Update/​ToolUpdateCommandTests.cs Updates tool update tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Uninstall/​ToolUninstallLocalCommandTests.cs Updates local uninstall tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Uninstall/​ToolUninstallGlobalOrToolPathCommandTests.cs Updates global uninstall tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Uninstall/​ToolUninstallCommandTests.cs Updates uninstall tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Restore/​ToolRestoreCommandWithMultipleNugetConfigTests.cs Updates tool restore tests.
test/​dotnet.Tests/​CommandTests/​Tool/​List/​ToolListLocalCommandTests.cs Updates local list tests.
test/​dotnet.Tests/​CommandTests/​Tool/​List/​ToolListGlobalOrToolPathCommandTests.cs Updates global list tests.
test/​dotnet.Tests/​CommandTests/​Tool/​List/​ToolListCommandTests.cs Updates list tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Install/​ToolInstallCommandTests.cs Updates install tests.
test/​dotnet.Tests/​CommandTests/​Tool/​Install/​InstallToolParserTests.cs Updates install parser tests.
test/​dotnet.Tests/​CommandTests/​Solution/​List/​GivenDotnetSlnList.cs Tests canceled solution loading.
test/​dotnet.Tests/​CommandTests/​Pack/​ReleasePropertyProjectLocatorTests.cs Supplies locator cancellation.
test/​dotnet.Tests/​CommandTests/​New/​DotnetSlnPostActionTests.cs Updates solution post-action tests.
test/​dotnet.Tests/​CommandTests/​New/​DotnetRestorePostActionTests.cs Updates restore post-action tests.
test/​dotnet.Tests/​CommandTests/​New/​DotnetAddPostActionTests.cs Updates add post-action tests.
test/​dotnet.Tests/​CommandTests/​MSBuild/​MSBuildArgumentCommandLineParserTests.cs Supplies parser cancellation.
test/​dotnet.Tests/​CommandTests/​MSBuild/​GivenDotnetPublishInvocation.cs Updates publish invocation tests.
test/​dotnet.Tests/​CommandTests/​MSBuild/​GivenDotnetPackInvocation.cs Updates pack invocation tests.
test/​dotnet.Tests/​CommandTests/​CommandInvocationTests.cs Tests action token propagation.
test/​dotnet.Tests/​CommandTests/​BuildServer/​Shutdown/​BuildServerShutdownCommandTests.cs Updates shutdown tests.
test/​dotnet-aot.Tests/​WorkloadUpdateTests.cs Updates AOT workload tests.
src/​Cli/​Microsoft.TemplateEngine.Cli/​TemplateInvoker.cs Passes tokens to post-actions.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionProcessors/​ProcessStartPostActionProcessor.cs Extends process post-action contract.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionProcessors/​PostActionProcessorBase.cs Adds processor cancellation.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionProcessors/​IPostActionProcessor.cs Extends post-action interface.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionProcessors/​InstructionDisplayPostActionProcessor.cs Updates processor signature.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionProcessors/​ChmodPostActionProcessor.cs Updates chmod processor signature.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionProcessors/​AddJsonPropertyPostActionProcessor.cs Updates JSON processor signature.
src/​Cli/​Microsoft.TemplateEngine.Cli/​PostActionDispatcher.cs Propagates post-action tokens.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​ProcessReaper.cs Adds explicit process termination.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​ProcessLifecycle.cs Adds process-wide cancellation.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​NativeMethods.txt Adds job termination API.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​ICommand.cs Adds token-aware execution.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​Extensions/​LockFileFormatExtensions.cs Adds lock-read cancellation.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​ExponentialRetry.cs Adds cancellation-aware retries.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​Command.cs Terminates canceled processes.
src/​Cli/​Microsoft.DotNet.Cli.Utils/​BuiltInCommand.cs Adds token-aware built-in execution.
src/​Cli/​Microsoft.DotNet.Cli.CommandLine/​CommandExtensions.cs Adds cancellable action adapter.
src/​Cli/​dotnet/​ToolPackage/​ToolPackageDownloader.cs Propagates download cancellation.
src/​Cli/​dotnet/​ToolPackage/​IToolPackageDownloader.cs Extends tool downloader APIs.
src/​Cli/​dotnet/​SlnFileFactory.cs Adds solution loading cancellation.
src/​Cli/​dotnet/​ShellShim/​ShellShimTemplateFinder.cs Adds shell-shim cancellation.
src/​Cli/​dotnet/​ReleasePropertyProjectLocator.cs Adds locator cancellation.
src/​Cli/​dotnet/​Program.cs Passes lifecycle cancellation to invocation.
src/​Cli/​dotnet/​Parser.cs Cancels help forwarding.
src/​Cli/​dotnet/​NugetPackageDownloader/​INuGetPackageDownloader.cs Extends NuGet downloader APIs.
src/​Cli/​dotnet/​NugetPackageDownloader/​IFirstPartyNuGetPackageSigningVerifier.cs Extends signing verification.
src/​Cli/​dotnet/​NugetPackageDownloader/​FirstPartyNuGetPackageSigningVerifier.cs Propagates signing cancellation.
src/​Cli/​dotnet/​FirstRunExperience.cs Preserves cancellation exceptions.
src/​Cli/​dotnet/​Commands/​Workload/​WorkloadManifestCorruptionRepairer.cs Cancels corruption repair.
src/​Cli/​dotnet/​Commands/​Workload/​WorkloadIntegrityChecker.cs Cancels integrity repair.
src/​Cli/​dotnet/​Commands/​Workload/​WorkloadCommandParser.cs Wires workload action tokens.
src/​Cli/​dotnet/​Commands/​Workload/​Uninstall/​WorkloadUninstallCommand.cs Propagates uninstall cancellation.
src/​Cli/​dotnet/​Commands/​Workload/​Search/​WorkloadSearchCommand.cs Updates search command contract.
src/​Cli/​dotnet/​Commands/​Workload/​Restore/​WorkloadRestoreCommand.cs Cancels workload restore.
src/​Cli/​dotnet/​Commands/​Workload/​Repair/​WorkloadRepairCommand.cs Cancels workload repair.
src/​Cli/​dotnet/​Commands/​Workload/​List/​WorkloadListCommand.cs Cancels manifest updates.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​WorkloadManifestUpdater.Managed.cs Propagates manifest cancellation.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​WorkloadManifestUpdater.cs Cancels background updates.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​WindowsMsiManifestInstaller.cs Cancels manifest extraction.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​IWorkloadManifestUpdater.cs Extends updater APIs.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​IWorkloadManifestInstaller.cs Extends installer APIs.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​IInstaller.cs Extends workload installer APIs.
src/​Cli/​dotnet/​Commands/​Workload/​Install/​FileBasedManifestInstaller.cs Cancels file manifest extraction.
src/​Cli/​dotnet/​Commands/​Workload/​History/​WorkloadHistoryCommand.cs Updates history command contract.
src/​Cli/​dotnet/​Commands/​Workload/​Elevate/​WorkloadElevateCommand.cs Updates elevate command contract.
src/​Cli/​dotnet/​Commands/​Workload/​Config/​WorkloadConfigCommand.cs Updates config command contract.
src/​Cli/​dotnet/​Commands/​Workload/​Clean/​WorkloadCleanCommand.cs Cancels workload cleanup.
src/​Cli/​dotnet/​Commands/​Tool/​Update/​ToolUpdateLocalCommand.cs Propagates local update cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Update/​ToolUpdateGlobalOrToolPathCommand.cs Propagates global update cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Update/​ToolUpdateCommand.cs Propagates update cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Uninstall/​ToolUninstallLocalCommand.cs Updates local uninstall contract.
src/​Cli/​dotnet/​Commands/​Tool/​Uninstall/​ToolUninstallGlobalOrToolPathCommand.cs Updates global uninstall contract.
src/​Cli/​dotnet/​Commands/​Tool/​Uninstall/​ToolUninstallCommand.cs Propagates uninstall cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​ToolCommandParser.cs Wires tool action tokens.
src/​Cli/​dotnet/​Commands/​Tool/​Store/​StoreCommand.cs Propagates store cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Search/​ToolSearchCommand.cs Updates search command contract.
src/​Cli/​dotnet/​Commands/​Tool/​Run/​ToolRunCommand.cs Updates tool execution contract.
src/​Cli/​dotnet/​Commands/​Tool/​Restore/​ToolRestoreCommand.cs Cancels tool restore.
src/​Cli/​dotnet/​Commands/​Tool/​Restore/​ToolPackageRestorer.cs Cancels package restoration.
src/​Cli/​dotnet/​Commands/​Tool/​List/​ToolListLocalCommand.cs Updates local list contract.
src/​Cli/​dotnet/​Commands/​Tool/​List/​ToolListGlobalOrToolPathCommand.cs Updates global list contract.
src/​Cli/​dotnet/​Commands/​Tool/​List/​ToolListCommand.cs Propagates list cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Install/​ToolInstallLocalInstaller.cs Cancels local installation.
src/​Cli/​dotnet/​Commands/​Tool/​Install/​ToolInstallLocalCommand.cs Propagates local install cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Install/​ToolInstallGlobalOrToolPathCommand.cs Propagates global install cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Install/​ToolInstallCommand.cs Propagates install cancellation.
src/​Cli/​dotnet/​Commands/​Tool/​Execute/​ToolExecuteCommand.cs Cancels tool restoration/execution.
src/​Cli/​dotnet/​Commands/​Test/​VSTest/​TestCommand.cs Propagates test cancellation.
src/​Cli/​dotnet/​Commands/​Test/​TestCommandParser.cs Wires test action tokens.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​TestModulesFilterHandler.cs Updates MTP initialization.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​MSBuildHandler.cs Cancels MTP project discovery.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​MicrosoftTestingPlatformTestCommand.Help.cs Uses lifecycle token for help.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​MicrosoftTestingPlatformTestCommand.cs Propagates MTP cancellation.
src/​Cli/​dotnet/​Commands/​Test/​MTP/​ITestHandler.cs Extends test handler contract.
src/​Cli/​dotnet/​Commands/​Test/​AotTestCommand.cs Wires AOT test cancellation.
src/​Cli/​dotnet/​Commands/​Solution/​SolutionCommandParser.cs Wires solution action tokens.
src/​Cli/​dotnet/​Commands/​Solution/​Remove/​SolutionRemoveCommand.cs Cancels solution removal.
src/​Cli/​dotnet/​Commands/​Solution/​Migrate/​SolutionMigrateCommand.cs Cancels solution migration.
src/​Cli/​dotnet/​Commands/​Solution/​List/​SolutionListCommand.cs Cancels solution listing.
src/​Cli/​dotnet/​Commands/​Solution/​Add/​SolutionAddCommand.cs Cancels solution additions.
src/​Cli/​dotnet/​Commands/​Sdk/​SdkCommandParser.cs Wires SDK action APIs.
src/​Cli/​dotnet/​Commands/​Sdk/​Check/​SdkCheckCommand.cs Updates SDK check contract.
src/​Cli/​dotnet/​Commands/​Run/​VirtualProjectBuildingCommand.cs Updates virtual build contract.
src/​Cli/​dotnet/​Commands/​Run/​RunCommand.cs Propagates run cancellation.
src/​Cli/​dotnet/​Commands/​Run/​Api/​RunApiCommandParser.cs Wires API action tokens.
src/​Cli/​dotnet/​Commands/​Run/​Api/​RunApiCommand.cs Cancels stdin reads.
src/​Cli/​dotnet/​Commands/​Run/​AotRunCommand.cs Wires AOT run cancellation.
src/​Cli/​dotnet/​Commands/​Restore/​RestoringCommand.cs Propagates restore cancellation.
src/​Cli/​dotnet/​Commands/​Restore/​RestoreCommand.cs Updates restore entry points.
src/​Cli/​dotnet/​Commands/​Reference/​Remove/​ReferenceRemoveCommand.cs Updates reference removal.
src/​Cli/​dotnet/​Commands/​Reference/​ReferenceCommandParser.cs Wires reference action tokens.
src/​Cli/​dotnet/​Commands/​Reference/​List/​ReferenceListCommand.cs Updates reference listing.
src/​Cli/​dotnet/​Commands/​Reference/​Add/​ReferenceAddCommand.cs Updates reference addition.
src/​Cli/​dotnet/​Commands/​Publish/​PublishCommand.cs Propagates publish cancellation.
src/​Cli/​dotnet/​Commands/​Project/​ProjectCommandParser.cs Wires project action tokens.
src/​Cli/​dotnet/​Commands/​Project/​Convert/​ProjectConvertCommand.cs Cancels project conversion.
src/​Cli/​dotnet/​Commands/​Package/​Search/​PackageSearchCommand.cs Updates package search contract.
src/​Cli/​dotnet/​Commands/​Package/​Remove/​PackageRemoveCommand.cs Updates package removal.
src/​Cli/​dotnet/​Commands/​Package/​PackageCommandParser.cs Wires package action tokens.
src/​Cli/​dotnet/​Commands/​Package/​List/​PackageListCommand.cs Propagates package-list cancellation.
src/​Cli/​dotnet/​Commands/​Package/​Add/​PackageAddCommand.cs Propagates package-add cancellation.
src/​Cli/​dotnet/​Commands/​Pack/​PackCommand.cs Propagates pack cancellation.
src/​Cli/​dotnet/​Commands/​New/​PostActions/​DotnetSlnPostActionProcessor.cs Cancels solution post-actions.
src/​Cli/​dotnet/​Commands/​New/​PostActions/​DotnetRestorePostActionProcessor.cs Cancels restore post-actions.
src/​Cli/​dotnet/​Commands/​New/​PostActions/​DotnetAddPostActionProcessor.cs Cancels add post-actions.
src/​Cli/​dotnet/​Commands/​New/​DotnetCommandCallbacks.cs Passes tokens to nested commands.
src/​Cli/​dotnet/​Commands/​MSBuild/​MSBuildForwardingApp.cs Updates MSBuild execution contract.
src/​Cli/​dotnet/​Commands/​MSBuild/​MSBuildCommandParser.cs Wires MSBuild parser APIs.
src/​Cli/​dotnet/​Commands/​MSBuild/​MSBuildCommand.cs Propagates MSBuild cancellation.
src/​Cli/​dotnet/​Commands/​Hidden/​Remove/​RemoveCommandParser.cs Wires hidden remove actions.
src/​Cli/​dotnet/​Commands/​Hidden/​List/​ListCommandParser.cs Wires hidden list actions.
src/​Cli/​dotnet/​Commands/​Hidden/​Add/​AddCommandParser.cs Wires hidden add actions.
src/​Cli/​dotnet/​Commands/​Dnx/​DnxCommandParser.cs Wires DNX cancellation.
src/​Cli/​dotnet/​Commands/​Clean/​FileBasedAppArtifacts/​CleanFileBasedAppArtifactsCommand.cs Updates clean contract.
src/​Cli/​dotnet/​Commands/​Clean/​CleanCommandParser.cs Wires clean action tokens.
src/​Cli/​dotnet/​Commands/​Clean/​CleanCommand.cs Propagates clean cancellation.
src/​Cli/​dotnet/​Commands/​BuildServer/​Shutdown/​BuildServerShutdownCommand.cs Updates shutdown contract.
src/​Cli/​dotnet/​Commands/​BuildServer/​BuildServerCommandParser.cs Wires shutdown cancellation.
src/​Cli/​dotnet/​Commands/​Build/​BuildCommand.cs Propagates build cancellation.
src/​Cli/​dotnet/​CommandInvocation.cs Uses cancellable invocation.
src/​Cli/​dotnet/​CommandFactory/​CommandResolution/​ProjectToolsCommandResolver.cs Cancels lock-file resolution.
src/​Cli/​dotnet/​CommandFactory/​CommandResolution/​MSBuildProject.cs Cancels lock-file reads.
src/​Cli/​dotnet/​CommandBase.cs Makes command execution token-aware.
src/​Cli/​dotnet-aot/​NativeEntryPoint.cs Propagates AOT lifecycle cancellation.

Comment thread src/Cli/dotnet/Program.cs Resolved
@github-actions

This comment has been minimized.

@baronfel
baronfel requested review from a team, lbussell and mthalman as code owners September 23, 2026 01:04
@github-actions

This comment was marked as outdated.

Comment thread src/Cli/dotnet-aot/NativeEntryPoint.cs Resolved
@baronfel
baronfel force-pushed the copilot/plumb-cancellationtokens-cli-commands branch 2 times, most recently from 883a7f1 to c768631 Compare September 29, 2026 20:20
baronfel and others added 10 commits October 1, 2026 10:27
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d8776d94-7dcc-4d87-bd8e-b7cb5fac7ac4

This branch has not been deployed

No deployments
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.

Plumb cancellationtokens through all CLI commands for consistent behavior

5 participants