Harden Azure Functions VS Code launch lifecycle - #19205
Conversation
Validate shell arguments and worker PIDs, adopt reused Functions tasks, improve process cleanup, and strengthen .NET 10 E2E coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3eabf6e8-5e26-4877-9f92-2265293a6b0f
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19205Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19205" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Hardens Azure Functions launch validation, task adoption, PID handling, and process-exit cleanup in the VS Code extension.
Changes:
- Validates shell arguments and worker PIDs before launch.
- Tracks reused tasks and polls worker liveness when task capture fails.
- Expands lifecycle tests and updates E2E fixtures to .NET 10.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
extension/src/debugger/languages/azureFunctions.ts |
Hardens launch and cleanup lifecycle. |
extension/src/test/azureFunctionsDebugger.test.ts |
Adds lifecycle, shell, and PID tests. |
extension/src/test/e2eLaunchProfile.test.ts |
Extends E2E source contracts. |
extension/src/test-e2e/helpers/fixtures.ts |
Targets .NET 10. |
extension/scripts/run-e2e.js |
Updates fixtures and shell-sensitive HTTPS arguments. |
extension/src/loc/strings.ts |
Adds localized invalid-PID error. |
extension/package.nls.json |
Registers the localization string. |
extension/loc/xlf/aspire-vscode.xlf |
Updates generated localization data. |
extension/CONTRIBUTING.md |
Documents updated E2E prerequisites and behavior. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Reject worker process IDs outside Node's signed 32-bit process range and cover the first invalid boundary. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3eabf6e8-5e26-4877-9f92-2265293a6b0f
Replace the natural-exit flag with explicit completion reasons and cover the full Functions-to-DCP lifecycle for task exit, worker disappearance, and explicit stop. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3eabf6e8-5e26-4877-9f92-2265293a6b0f
This comment has been minimized.
This comment has been minimized.
Make the Azure Functions E2E contract assert each generated project TFM instead of accepting a single net10.0 match. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3eabf6e8-5e26-4877-9f92-2265293a6b0f
This comment has been minimized.
This comment has been minimized.
Invoke the Azure Functions Core Tools .cmd shim through ComSpec so the E2E runner can validate it on Windows. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3eabf6e8-5e26-4877-9f92-2265293a6b0f
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Waiting on #19237 |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (1)
extension/src/debugger/languages/azureFunctions.ts:507
JSON.parsecan returnnullfor a syntactically valid NDJSON line. Dereferencingevent.namethen throws an unlocalizedTypeError, so malformed Core Tools output can still bypass the localized launch error. Parse asunknownand narrow to a non-null object before readingname; add a regression case containingnull\n.
if (event.name !== 'dotnet-worker-startup') {
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (2)
extension/src/test/e2eLaunchProfile.test.ts:524
- This contract still misses a generated E2E project:
extension/src/test-e2e/appHostLifecycleTools.e2e.test.ts:749writesLinkedAppHost.csprojwithnet8.0, and that spec runs in the workflow matrix. Consequently, installing only the SDK fromglobal.jsondoes not remove the suite's implicit .NET 8 dependency, contrary to this PR's stated goal. Update that generator tonet10.0and include it in this contract.
assert.deepStrictEqual(fixtureTargetFrameworks, ['net10.0']);
extension/CONTRIBUTING.md:136
- This statement is not yet accurate:
extension/src/test-e2e/appHostLifecycleTools.e2e.test.ts:749still generates a linked-worktree AppHost targetingnet8.0, and that spec is part of the E2E workflow matrix. Either move that fixture to .NET 10 as intended by this PR or document the remaining .NET 8 prerequisite.
The E2E fixtures target .NET 10, matching the SDK pinned by the repository's `global.json`. The Azure Functions shard additionally requires Azure Functions Core Tools v4 (`func`) on `PATH`. It installs the real .NET Install Tool, C#, Azure Resource Groups, and Azure Functions extensions into the isolated VS Code instance, generates a dedicated HTTPS certificate with shell-sensitive arguments, and activates the Azure Functions extension so it registers its `func` task definition and listeners. Aspire then creates and runs a registered `func: host start` task for the generated .NET isolated Functions resource; the shard probes its HTTPS endpoint and verifies that stopping the Aspire resource ends the same VS Code task. CI runs this shard on Linux with pinned, checksum-verified copies of Core Tools 4.12.1, .NET Install Tool 3.1.0, C# 2.148.23 for Linux x64, Azure Resource Groups 0.12.7, and Azure Functions 1.22.0.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
extension/src/debugger/languages/azureFunctions.ts:504
- This catch treats every JSON parse failure as an in-flight final record, including malformed records that are already newline-terminated. Such a record is silently skipped, so the launch can time out or attach using a later event instead of reporting the malformed Core Tools NDJSON directly. Only suppress the parse error for the final unterminated line; complete malformed records should fail with a localized error.
} catch {
// The final NDJSON line may still be in flight.
continue;
Tests selector (audit mode)The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement. 0 / 102 test projects · 2 jobs, from 9 changed files. Selected test projects (0 / 102)none — no .NET test projects run for this change. Selected jobs (2)
How these were chosen — grouped by what changedJob reasons
Selection computed for commit |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Adam Ratzman (adamint)
left a comment
There was a problem hiding this comment.
The current-head malformed-NDJSON finding is still unresolved and blocks approval. I didn't find a separate issue beyond that existing review note.
|
The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests. Suspected flaky test(s):
Suggested actions:
You can re-run the failed jobs from the workflow run page. |
|
See the workflow run for details: https://github.com/microsoft/aspire/actions/runs/32293779350 Added a note to the VS Code extension docs ( |
Description
Issue #19138 tracked seven follow-up gaps in the Azure Functions VS Code launch lifecycle and E2E coverage. Since the issue was filed, #19313 replaced the
startFuncProcessAPI path with an Aspire-owned, registeredfunctask. That currentmainimplementation now owns the exact task execution, reports task exits, and avoids signalling a worker PID after natural task exit.This PR completes the remaining follow-up work against that registered-task design:
bash,dash,ash,zsh,fish, andkshtask shells while continuing to reject shells whose quoting rules are unsupported.func.cmdpreflight throughComSpec, which Node requires for.cmdfiles.global.jsonbefore Azure Functions prerequisites.User-facing behavior
Unsupported shell arguments and invalid launch data now fail directly, before a project build or debugger attachment.
dashandashconfigurations work like other POSIX shells. The resulting registered-task lifecycle reports Azure Functions exits and stops the exact task without risking termination of a recycled worker PID.Validation
The real Azure Functions E2E shard is exercised by the pull request workflow with pinned Core Tools and VS Code extension prerequisites.
Fixes #19138
Checklist
<remarks />and<code />elements on your triple slash comments?