Backport fix for issue 15806 ( ("aspire stop" is not cleaning up application containers on Windows)#16123
Merged
joperezr merged 3 commits intorelease/13.2from Apr 14, 2026
Merged
Conversation
…ers) (#16006) * Fix issue 15806 * Change default process start time check tolerance to 1 second (to match the start time granularity used by the backchannel) * Address code review feedback from Mitch * Add ExecuteCommandUntilOutputAsync test helper * Ensure containers are cleaned up by "aspire stop" command * Improved check for container cleanup # Conflicts: # src/Aspire.Cli/Program.cs
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16123Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16123" |
Contributor
There was a problem hiding this comment.
Pull request overview
Backports fixes related to aspire stop on Windows so that stopping a detached AppHost does not tear down DCP in a way that prevents container cleanup, and adds test coverage improvements to reduce flaky polling.
Changes:
- Introduces a shared
ProcessSignalerhelper for start-time-guarded process lookup plus graceful shutdown / force-kill. - Updates stop/orphan-detection paths to rely on the shared process helper and include CLI start time in backchannel data.
- Enhances CLI E2E start/stop tests with a helper that waits for expected command output and an additional cleanup assertion.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Shared/Hex1bAutomatorTestHelpers.cs | Adds a retrying “execute until output” helper used by E2E tests. |
| tests/Aspire.Cli.EndToEnd.Tests/StartStopTests.cs | Uses unique project names and asserts post-stop cleanup via Docker network listing. |
| src/Shared/ProcessSignaler.cs | New shared process signaling + start-time verification utility. |
| src/Aspire.Hosting/Cli/CliOrphanDetector.cs | Replaces direct Process.GetProcessById checks with ProcessSignaler logic. |
| src/Aspire.Hosting/Backchannel/BackchannelDataTypes.cs | Adds CliStartedAt to AppHostInformation for PID reuse protection. |
| src/Aspire.Hosting/Backchannel/AuxiliaryBackchannelRpcTarget.cs | Plumbs ASPIRE_CLI_STARTED into AppHostInformation.CliStartedAt. |
| src/Aspire.Hosting/Aspire.Hosting.csproj | Links in shared ProcessSignaler for Hosting. |
| src/Aspire.Cli/Program.cs | Adds SIGTERM cancellation handling (non-Windows) and logs log-file path + PID. |
| src/Aspire.Cli/Processes/DetachedProcessLauncher.Windows.cs | Adjusts Windows detached process creation flags for process-group signaling. |
| src/Aspire.Cli/Commands/StopCommand.cs | Switches from killing process trees to graceful shutdown + targeted force-kill with start-time guard. |
| src/Aspire.Cli/Aspire.Cli.csproj | Links in shared ProcessSignaler for CLI. |
Contributor
|
🎬 CLI E2E Test Recordings — 53 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24359447813 |
joperezr
approved these changes
Apr 14, 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.
Backporting fixes from #16006 and #16120