Repository navigation
Fix VS Code extension re-adding nonexistent configured AppHost path - #20112
Conversation
…adding as candidate
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20112Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20112" |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Ella Hathaway (ellahathaway)
left a comment
There was a problem hiding this comment.
The missing-file guard does not address the underlying re-insertion after aspire ls succeeds. Please fix that in the extension, preserve older-CLI fallback, update the tests, and isolate the external-AppHost fixture as noted in the three inline comments.
Configuration selects a discovered AppHost without manufacturing candidates. Preserve legacy CLI selected_project_file metadata, including older selected-only results and filesystem aliases. Validate configured external .NET projects through the existing file-fallback AppHost recognizer. Deduplicate aliases by native identity without dropping case-only paths in case-sensitive Windows directories. Log invalid or unreadable targets without discarding usable candidates, isolate external fixtures, and add focused and real VS Code regressions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 2e79ae9e-900d-4085-951b-7c801db5ca68
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the reported behavior and includes comprehensive focused coverage.
0 open findings
What changed in this PR
Separates AppHost discovery from configuration-based selection, preventing stale configured paths from creating phantom AppHosts.
Changes:
- Treats successful CLI discovery as authoritative.
- Validates configured projects during file fallback and deduplicates filesystem aliases.
- Adds unit, repository, and VS Code E2E regression coverage.
| File | Description |
|---|---|
extension/src/utils/appHostProjectFiles.ts |
Validates configured fallback projects. |
extension/src/utils/appHostDiscovery.ts |
Selects without manufacturing candidates. |
extension/src/utils/appHostCandidateParsing.ts |
Preserves legacy CLI selection. |
extension/src/test/appHostDiscovery.test.ts |
Covers discovery and fallback scenarios. |
extension/src/test/appHostDataRepository.test.ts |
Covers external configured candidates. |
extension/src/test-e2e/discoveryConfiguration.e2e.test.ts |
Adds stale-path E2E regression coverage. |
extension/CONTRIBUTING.md |
Documents discovery semantics. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
79544fa
into
microsoft:main
Description
Fixes #20013
Prevent stale or mistyped configured paths from appearing as phantom, buildable AppHosts in VS Code. Candidate discovery and default selection are now separate: configuration can select a discovered AppHost, but cannot add one omitted by successful CLI discovery.
Discovery and selection
Successful
aspire lsresults are authoritative, including empty results and both buffered and streaming output._selectConfiguredAppHostCandidatepreserves CLI-provided selection, otherwise marks an existing candidate that matches configuration by filesystem identity. If no candidate matches, the returned list is unchanged.For example, when
lsreturnsaspire-apphost.csprojbut configuration references the nonexistentaspire_apphost.csproj, only the real project remains in the extension's candidate list. An existing ordinary project also stays excluded if the CLI did not return it; checking file existence alone would not enforce this boundary.Compatibility and file fallback
selected_project_file, including older responses where the selected project is absent fromall_project_file_candidates. This is a CLI-declared selection, not a candidate inferred from configuration..csproj,.fsproj, and.vbprojfiles alongside scanned projects. Both use the existing AppHost-content recognizer. Missing, directory, unreadable, unsupported, and non-AppHost targets are skipped without discarding useful candidates. This is content-based recognition, not a guarantee that MSBuild will succeed.No new dependencies or CLI output-contract changes are required.
Regression coverage
The tests exercise the discovery service and repository rather than only the selection helper:
The real VS Code E2E regression writes a stale configured path, executes Refresh AppHosts, and asserts the complete candidate list, selected real AppHost, and absence of a discovery error. Editor-source and external-selection mocks now return the configured candidate from
ls. The external fixture uses siblingworkspaceandexternaldirectories under one unique cleanup root.Validation
TypeScript test compilation and targeted ESLint passed. The focused discovery/repository suites passed 249 tests, and the freshly packaged real VS Code discovery/configuration E2E shard passed 4 tests with 0 failures or pending tests. The prior fallback implementation failed both distinct-identity regressions while passing their equal-identity control; the corrected implementation passes all three.
These are targeted local results, not a claim that every PR CI job has completed.
Checklist
<remarks />and<code />elements on your triple slash comments?