Fix extension CLI teardown during AppHost build - #20021
Fix extension CLI teardown during AppHost build#20021Ella Hathaway (ellahathaway) wants to merge 1 commit into
Conversation
Route extension stop requests through cooperative cancellation and wait for in-flight pre-build cleanup before the CLI exits. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20021Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20021" |
Tests selector2 / 99 PR test projects · 4 PR jobs · 1 advisory-only target, from 5 changed files. Selected PR test projects (2 / 99)
Selected PR jobs (4)
Advisory workflow impact (1)
How these were chosen — grouped by what changed📦 affected project 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟡 Changes recommended
The five-second cleanup timeout can still let a pending build outlive the CLI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Routes extension stop requests through cooperative CLI cancellation and waits for AppHost build cleanup.
Changes:
- Replaces immediate CLI termination with cancellation-manager signaling.
- Adds pending build cleanup handling and regression tests.
File summaries
| File | Description |
|---|---|
src/Aspire.Cli/Backchannel/ExtensionRpcTarget.cs |
Cooperatively cancels CLI execution. |
src/Aspire.Cli/Commands/RunCommand.cs |
Waits for canceled pre-build work. |
tests/Aspire.Cli.Tests/Backchannel/ExtensionBackchannelTests.cs |
Tests stop-request cancellation. |
tests/Aspire.Cli.Tests/Commands/RunCommandTests.cs |
Tests cleanup ordering. |
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs |
Supplies the cancellation manager. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| if (!buildWaitCompleted && | ||
| runCts is not null && | ||
| runTask is not null && | ||
| !runTask.IsCompleted) | ||
| { | ||
| await CancelAppHostStartupAsync(runCts, runTask, CancellationToken.None).ConfigureAwait(false); | ||
| } |
Description
Stopping a dynamic debug session could terminate the Aspire CLI while a cold single-file AppHost build was still running. On Windows, the orphaned
dotnet buildprocess retained the fixture workspace as its working directory, causing E2E teardown to fail withEBUSY.This change routes extension stop requests through cooperative CLI cancellation so the existing child-process shutdown path runs. It also makes
RunCommanddrain pending pre-build work before returning from cancellation, preventing a late build from outliving the CLI.Validation:
RunCommandTestsandExtensionBackchannelTestspassed.dynamic-debug-configurationshard passed 3/3.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?