Skip to content

Fix manifest editor: repeated elements, CDATA, UWP-only SupportsMultipleInstances, image path probing - #394

Draft
Chiara Mooney (chiaramooney) wants to merge 3 commits into
mainfrom
chiaramooney-manifest-editor-fixes
Draft

Chiara Mooney (chiaramooney) wants to merge 3 commits into
mainfrom
chiaramooney-manifest-editor-fixes

Conversation

@chiaramooney

@chiaramooney Chiara Mooney (chiaramooney) commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Four manifest editor fixes:

  • Repeated extension elements edit the right one. Before, editing the second <Task>, <uap3:Host> or <uap:FileType> overwrote the first. Each field now carries the path to its element. Labels are numbered when names repeat (Task[1].Type, Task[2].Type), and edits land on that exact element. If the document changed and the path no longer points at an element with that name, the edit is skipped.
  • CDATA survives edits. Editing text inside <![CDATA[...]]> (package Description, extension text such as FileType) keeps the CDATA wrapper instead of rewriting it as escaped text. A literal ]]> or </ in the value is split across CDATA sections, so the result stays valid XML and later edits still find the real closing tag.
  • SupportsMultipleInstances is UWP-only. The "Add Supports Multiple Instances" button is hidden for packaged desktop apps. If a desktop app already has the attribute, it stays visible with a warning so it can be removed. An app counts as desktop when:
    • RuntimeBehavior is packagedClassicApp or win32App, or EntryPoint is Windows.FullTrustApplication/Windows.PartialTrustApplication; or
    • it uses the VS / WinUI 3 template token EntryPoint="$targetentrypoint$" and the project file next to the manifest is a desktop project (UseWinUI, the Windows App SDK, WindowsPackageType, or a .wapproj). A UAP or UseUwp project keeps it UWP; or
    • there is no recognizable project file, and the package declares runFullTrust without a windows.fullTrustProcess helper. UWP templates don't declare runFullTrust.
  • No more local file-existence check from the webview. checkImagePath no longer touches disk for paths outside the manifest folder and open workspace folders. Such paths show "Image is outside the package and workspace. Use Choose file to copy it into Assets." When Choose file picks an image outside the package and workspace, it is copied into Assets\ in one step, because a package can't reference files outside it.

Related fixes found along the way:

  • The webview regex that routes extension-field validation errors to their inputs used \d inside a template literal, which emits a plain d, so extension-field errors were never shown in the form. They now appear, and errors for repeated elements land on the correct input.
  • Because those errors are now visible, FileTypeAssociation.Name is validated against the schema type ST_FTAName instead of a stricter regex that rejected valid names like my-files.
  • Setting a package property (for example Description) to the value it already has no longer inserts a second copy of the element.

Usage Example

<Extension Category="windows.backgroundTasks" EntryPoint="Tasks.Bg">
  <BackgroundTasks>
    <Task Type="timer" />
    <Task Type="systemEvent" />
  </BackgroundTasks>
</Extension>

The editor shows Task[1].Type and Task[2].Type. Editing the second changes only <Task Type="systemEvent" /> (covered by unit tests).

Related Issue

Fixes #128
Fixes #151
Fixes #152
Fixes #263
Fixes #167
Fixes #289

Type of Change

  • 🐛 Bug fix
  • 🧪 Test update

Checklist

  • New tests added for new functionality (if applicable)
  • Tested locally on Windows (if applicable)

Screenshots / Demo

Not captured yet. The webview behavior is covered by Playwright specs (webview-state.spec.ts, applications-tab.spec.ts).

Additional Notes

Validation (local, Windows):

  • npm run compile-tsc: passed
  • npm run lint: 0 errors (10 warnings, all already present)
  • npm run test:unit: passed (1712 + 31 node tests, 40 mocha)
  • npx playwright test applications-tab: 58 passed, 1 flaky (can remove Square 310x310 Logo visual asset, also flaky on unmodified main).
  • npx playwright test webview-state properties-tab: passed (restoring values clears errors passed on retry).
  • Not exercised: the native Choose file dialog itself. Playwright can't drive it, so the one-step copy for outside files was checked by code review only.

Behavior change (#167): typing an absolute path to an image outside the workspace no longer gives a one-click "Copy to Assets" link. Use Choose file, which now copies outside images into Assets\ directly. Files inside the workspace but outside the package still get the one-click link.

Project detection (#263) reads only project files in the manifest's own folder (up to 1 MB each), once when the editor opens. A manifest whose project lives elsewhere falls back to the runFullTrust check.

AI Description

This section is auto-generated by AI when the PR is opened or updated. To opt out, delete this entire section including the marker comments.

… image path probing

- Target repeated extension child elements by element path and label them (Task[2].Type) (#128, #151, #289)
- Preserve CDATA sections when editing text content (#152)
- Only offer SupportsMultipleInstances for UWP apps; warn when set on desktop apps (#263)
- Never inspect webview-supplied image paths outside the package/workspace; copy them only via a native picker (#167)
- Fix extension-field validation routing regex that emitted 'd' instead of '\d'

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@chiaramooney Chiara Mooney (chiaramooney) added agent-preparing Agent work in progress (feedback, validation, or CI) manifest-editor labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

VSIX Build

Artifact Baseline Current Delta
VS Code Extension (VSIX) 72.47 MB 72.47 MB 📈 +1.8 KB (+0.00%)

Updated 2026-11-25 00:40:36 UTC · commit 6f79fee · workflow run

…py, schema-based FTA name check

- applyFieldChange inserts only when the element is missing, so writing the current value no longer duplicates it
- Browse copies images from outside the package/workspace into Assets; drop the second picker link
- Validate FileTypeAssociation.Name against ST_FTAName instead of a stricter regex
- Split '</' inside CDATA so later edits find the real closing tag
- Test that repeated-element errors route to the matching input

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ances (#263)

Template manifests use EntryPoint="$targetentrypoint$" with no RuntimeBehavior. The editor now reads
the project file next to the manifest (UseWinUI / Windows App SDK / .wapproj vs UAP / UseUwp) and
falls back to the runFullTrust capability (without a windows.fullTrustProcess helper) when no
project file is recognized.

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