Repository navigation
Conversation
|
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 ensure that the AOT-enabled commands also adopt this pattern |
Done in dd7d0e9 (short hash may differ after push): |
|
@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 |
Addressed in 3f5b0e1 (short hash may differ after push):
Verified all affected projects build cleanly and reran the targeted tests ( |
|
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. |
There was a problem hiding this comment.
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
Open (15)
SIGTERM does not trigger cooperative cancellation · New Cancellation is swallowed as a post-action failure · New Post-action process wait ignores cancellation · New Build-server shutdown wait ignores cancellation · New MSBuild forwarding ignores cancellation · New Package callback swallows cancellation · New NuGet package operation ignores cancellation · New Restore cancellation is converted to failure · New AOT launch does not receive cancellation · New dotnet run application launch ignores cancellation · New File-based build ignores cancellation · New Built-test VSTest process ignores cancellation · New Tool execution ignores cancellation · New Tool search network request ignores cancellation · New External dotnet commands ignore cancellation · New
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. |
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
883a7f1 to
c768631
Compare
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
c768631 to
679bb86
Compare

dotnetcommands 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 usedCancellationToken.None. This change makes cancellation follow the full CLI process lifecycle and propagate through the command stack.Highlights
CommandBase.Execute()to accept aCancellationTokenand updated command implementations and parser registrations throughout the CLI.SetActionadapter so System.CommandLine action tokens reach synchronous command handlers without repeatedTask.FromResultwrappers.ProcessLifecycle.CancellationTokenfor work outside an action-scoped token and pass it into managed and Native AOT invocation.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.ProcessLifecycleowns process signals andProcessReaperowns child-process forwarding and cleanup.dotnet runsignal 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.CancellationToken.Noneuse undersrc/Cli; tests may still passCancellationToken.Nonewhen cancellation is intentionally not under test.End-to-end propagation
Cancellation is now carried through:
dotnet newpost-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.dotnet-*commands, and Native AOT run/test/file execution, including process-tree termination when cooperative cancellation is requested.RunApiCommandnow usesConsole.In.ReadLineAsync(cancellationToken), so cancellation interrupts a pending stdin read rather than waiting for another line.Validation
ProcessLifecycle.SdkRootLocator.AssertMatchesSelfLocation; the full suite therefore was not reported as passing.