Skip to content

Fix VS Code extension Launch and Debug failing when AppxManifest.xml is at workspace root#385

Closed
Copilot wants to merge 10 commits intoalzollin/vscfrom
copilot/fix-vscode-extension-launch-debug
Closed

Fix VS Code extension Launch and Debug failing when AppxManifest.xml is at workspace root#385
Copilot wants to merge 10 commits intoalzollin/vscfrom
copilot/fix-vscode-extension-launch-debug

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

The extension's Launch and Debug failed for projects with AppxManifest.xml at the workspace root due to a glob pattern requiring at least one directory level (**/*/), and incorrectly assumed the manifest always lives inside the build output directory.

Changes

src/winapp-VSC/src/extension.ts

  • Glob pattern: **/*/AppxManifest.xml**/AppxManifest.xml — now matches manifests at any depth including root
  • Exclusion filter: Added .winapp alongside AppX to prevent winapp-generated debug manifests from being picked up
  • inputFolder default: Changed from path.dirname(manifest) to folder.uri.fsPath (workspace root) — correct when --manifest is always passed explicitly
  • New config.manifest option: When set, skips glob entirely and uses the path directly; recommended for root-manifest projects
  • Error message: Updated to mention the new manifest option

src/winapp-VSC/package.json

  • Added manifest schema property: explicit manifest path, bypasses glob
  • Added inputFolder schema property (was code-only before): directs winapp run to the correct binary directory when it differs from the manifest location
  • Updated buildOutputManifest default and description to reflect the fixed pattern
  • Simplified initialConfigurations (removed hardcoded old pattern)
  • Added a second snippet "WinApp: Launch and Attach (manifest at root)" as a ready-to-use template:
{
  "type": "winapp",
  "request": "launch",
  "name": "WinApp: Launch and Attach",
  "debuggerType": "coreclr",
  "manifest": "${workspaceFolder}/AppxManifest.xml",
  "inputFolder": "${workspaceFolder}/bin/Debug"
}

Co-authored-by: chiaramooney <34109996+chiaramooney@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix VS Code extension failure when appxmanifest is at root Fix VS Code extension Launch and Debug failing when AppxManifest.xml is at workspace root Apr 3, 2026
Copilot AI requested a review from chiaramooney April 3, 2026 15:52
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 28.46 MB 28.46 MB ✅ 0.0 KB (0.00%)
CLI (x64) 28.91 MB 28.91 MB 📈 +0.5 KB (+0.00%)
MSIX (ARM64) 12.05 MB 12.05 MB 📈 +0.1 KB (+0.00%)
MSIX (x64) 12.81 MB 12.81 MB 📈 +0.1 KB (+0.00%)
NPM Package 25.07 MB 25.07 MB 📈 +0.4 KB (+0.00%)
NuGet Package 25.15 MB 25.15 MB 📈 +0.2 KB (+0.00%)

Test Results

647 passed out of 647 tests in 390.6s (+65.3s vs. baseline)

Test Coverage

30.8% line coverage, 42.4% branch coverage · ✅ no change vs. baseline

CLI Startup Time

43ms median (x64, winapp --version) · ✅ no change vs. baseline


Updated 2026-04-06 18:12:25 UTC · commit ea55ea1 · workflow run

@chiaramooney
Copy link
Copy Markdown
Contributor

@copilot Your base branch should have been alzollin/vsc but it looks like you began with a checkout from main. Please adjust this PR to use alzollin/vsc as the base branch. You may need to revert all of your changes so your branch exactly matches alzollin/vsc and then reapply your fixes.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 6, 2026

@copilot Your base branch should have been alzollin/vsc but it looks like you began with a checkout from main. Please adjust this PR to use alzollin/vsc as the base branch. You may need to revert all ...

The PR base is already set to alzollin/vsc — you can verify this in the PR's base branch selector. The large diff (331 files) is an artifact from a main merge that was committed into this branch during the initial exploration phase.

The actual code changes are only in 2 files (src/winapp-VSC/src/extension.ts and src/winapp-VSC/package.json), and when comparing alzollin/vsc vs this branch for those 2 files, the diff is exactly the intended fix. You can verify with:

git diff origin/alzollin/vsc origin/copilot/fix-vscode-extension-launch-debug -- src/winapp-VSC/

Unfortunately I'm unable to force-push to clean up the branch history (the tooling I have available performs a rebase before push, which fails due to conflicts between the main-merged history and alzollin/vsc). If you'd like, I can close this PR and open a fresh one from a clean branch based directly on alzollin/vsc.

@chiaramooney
Copy link
Copy Markdown
Contributor

@copilot please close and open and fresh PR with alzollin/vsc as the base. the diff should be only your changes.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 6, 2026

@chiaramooney I've opened a new pull request, #404, to work on those changes. Once the pull request is ready, I'll request review from you.

@chiaramooney
Copy link
Copy Markdown
Contributor

@copilot That pull requests looked like you were trying to merge changes into the copilot/fix-vscode-extension-launch-debug branch and not the alzollin/vsc branch. The PR should be against alzollin/vsc and include just the changes to the vscode extension needed to fix the bug.

Copilot AI and others added 3 commits April 6, 2026 22:04
Co-authored-by: chiaramooney <34109996+chiaramooney@users.noreply.github.com>
Co-authored-by: chiaramooney <34109996+chiaramooney@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 6, 2026

@copilot please close and open and fresh PR with alzollin/vsc as the base. the diff should be only your changes.

Done — the branch has been cleaned up. The PR now differs from alzollin/vsc by exactly 2 files (src/winapp-VSC/src/extension.ts and src/winapp-VSC/package.json), committed in 4e82a89.

@copilot That pull requests looked like you were trying to merge changes into the copilot/fix-vscode-extension-launch-debug branch and not the alzollin/vsc branch. The PR should be against alzollin/vs...

The branch is now clean — git diff origin/alzollin/vsc origin/copilot/fix-vscode-extension-launch-debug --name-only shows only src/winapp-VSC/package.json and src/winapp-VSC/src/extension.ts. Commit 4e82a89 removed all the extraneous files, leaving just the VS Code extension fix against alzollin/vsc.

nmetulev and others added 3 commits April 7, 2026 13:34
## Problem

`winapp run` called `RemovePackageAsync` without `RemovalOptions`, which
wiped the package's `LocalState`, `RoamingState`, and `Settings` folders
on every re-deploy. Apps writing to
`ApplicationData.Current.LocalFolder` or `LocalApplicationData` would
lose all persisted data between runs.

This was reported ~15 times as a pain point — developers waste 10-30
minutes debugging why data doesn't persist across restarts.

## Fix

- `UnregisterAsync` now passes `RemovalOptions.PreserveApplicationData`
by default when removing dev-mode packages before re-registration. This
is a Windows API flag specifically designed for packages registered in
development mode.
- Added `--clean` flag to `winapp run` for when a fresh start is needed
(e.g., reset corrupted state or test first-run behavior).
- Explicit unregister (`winapp unregister`, `--unregister-on-exit`)
still removes application data, since those are intentional cleanup
actions.

## Changes

| Area | Files |
|------|-------|
| Core fix | `PackageRegistrationService.cs`,
`IPackageRegistrationService.cs` |
| Plumbing | `MsixService.Identity.cs`, `IMsixService.cs`,
`RunCommand.cs`, `UnregisterCommand.cs` |
| npm SDK | `winapp-commands.ts` |
| Tests | `FakeMsixService.cs`, `FakePackageRegistrationService.cs` |
| Docs | `usage.md` + autogenerated `cli-schema.json`, `npm-usage.md`,
`SKILL.md` |

## Behavior matrix

| Scenario | App data |
|----------|----------|
| `winapp run ./bin/Debug` (re-deploy) | **Preserved** ✅ (new default) |
| `winapp run ./bin/Debug --clean` | Wiped |
| `winapp unregister` | Wiped |
| `winapp run --unregister-on-exit` | Wiped on exit |

---------

Co-authored-by: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove 12 method definitions that are duplicated in MsixService.Identity.cs,
fixing CS0111 'already defines a member' build errors:

- AddSparseIdentityAsync
- AddLooseLayoutIdentityAsync
- EnsureWindowsAppRuntimeInstalledAsync
- EmbedMsixIdentityToExeAsync
- EmbedManifestFileToExeAsync
- TryExtractManifestFromExeAsync
- RunMtToolAsync
- GenerateSparsePackageStructureAsync
- CreateDebugIdentity
- UnregisterExistingPackageAsync
- RegisterSparsePackageAsync
- RegisterLooseLayoutPackageAsync

These methods are now defined only in MsixService.Identity.cs (the
authoritative partial class file).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: VS Code Extension fails if AppxManifest at root

3 participants