Repository navigation
Surface winapp run project mode in the palette and debugger - #283
Conversation
winapp run gained a project mode (accepting .csproj/.sln/.slnx or a directory containing one) alongside the existing build-output-folder mode, plus options for configuration, architecture, framework, runtime, MSBuild properties, and build/restore/launch behavior. None of it was reachable from the extension: winapp.run only scanned for folders containing .exe files, and the debug adapter hardcoded ['run', inputFolder]. Add two shared, vscode-free modules: - run-target.ts classifies an input as project/solution/folder and discovers candidates. Globbing for project files is the primary discovery mechanism, so the much more expensive **/*.exe scan is now only a fallback. - run-options.ts owns WinAppRunOptions, deterministic argv construction, and validation of the CLI's mutually exclusive combinations. Both the palette command and the debug adapter now build their arguments through buildRunArgs, so option handling can no longer drift between them. Users choose what to run, never which CLI mode to use; the mode is derived from the selection and only gates which options apply. winapp.run stays a single prompt by taking its build settings from resource-scoped configuration, and a new winapp.runAdvanced collapses the remaining options into one multi-select. Target discovery now searches every folder of a multi-root workspace rather than only the first. launch.json gains input (superseding inputFolder, which keeps working via a deprecation alias) and twelve new properties. --detach, --no-launch, and --debug-output are rejected for debug sessions, since each leaves no process for the debugger to attach to. Validation had to branch on target kind: requiring an .exe made sense for a build output folder but rejects every project, where producing that output is the whole point. Co-authored-by: Copilot App <[email protected]>
The run settings were added as a second contributes.configuration block rather than merged into the existing one. Duplicate keys are legal JSON and JSON.parse silently keeps the last occurrence, so this quietly deleted winapp.appDirectories and the three manifest settings — with no syntax error and no failing parse. Only the esbuild bundle step warned about it. Merge the four run settings into the existing block, and add a test that scans the raw document for duplicate keys, since any check built on JSON.parse is blind to them by construction. The test also pins the contributions this feature depends on: resource scope on the run settings, an activation event per command, the inputFolder deprecation alias, and the absence of options the debug adapter rejects. Co-authored-by: Copilot App <[email protected]>
Run-target discovery depends on VS Code's findFiles indexing and on real workspace-folder resolution, so the unit tests cannot reach it. In particular nothing verified the multi-root fix end to end, which is the part most likely to regress quietly. Each test dismisses the picker with Escape so the CLI is never invoked. The solution test drives the advanced command deliberately: deduplication leaves a single candidate there, which the plain command would auto-select and launch. Assert on the full picker placeholder rather than a substring. The command palette's own placeholder is "Type the name of a command to run", so a loose match reads the palette's rows instead of the picker's and the test passes or fails for the wrong reason. Co-authored-by: Copilot App <[email protected]>
Every existing test asserts that buildRunArgs emits what we intended it to emit. None can catch the intent itself being wrong: a flag the CLI spells differently, or never had, produces a confident green suite and a runtime failure. Nothing checked our 20 option names against the real surface. Check them against a fixture generated from winapp --cli-schema rather than transcribed from --help, so the fixture cannot drift through copying mistakes. A renamed or dropped option now fails here and becomes an explicit decision at the point of a CLI version bump. Walk the argv using the schema instead of scanning for tokens that start with a dash. The obvious heuristic is wrong: --args takes values like "--flag value" that begin with a dash themselves, and would be misread as a bare flag. Confirmed the check is not vacuous by mutating the source three ways -- renaming a flag, dropping one, and giving a boolean a value -- and confirming each fails with a message naming the specific problem. Co-authored-by: Copilot App <[email protected]>
Nothing executed the CLI. The unit tests assert buildRunArgs emits what was intended, the contract test checks those flags against the CLI schema, and the picker spec escapes out before anything runs. All of it stops at the argument vector. The palette path has an unverified layer underneath: runWinappRun joins the argv with escapePowerShellArg and sends it to a PowerShell terminal, so a shell re-parses the arguments between the array under test and the process that runs. Scaffold a real WinUI app and drive a full build, deploy, and launch through the command palette. Assert against Get-AppxPackage and Get-Process rather than terminal text, so the test verifies what happened rather than what was printed. The second test pins the settings path by checking that a Release configuration reaches the CLI and the Debug default does not. Keep it opt-in behind E2E_LIVE_RUN. Unlike the rest of the suite it registers an MSIX package and launches a GUI app, and it takes minutes rather than seconds. Skip with a diagnostic when the SDK, templates, or CLI are missing. Launch with --disable-extensions and a seeded profile. C# Dev Kit otherwise opens an announcement tab that steals focus from the palette and builds the project itself, corrupting the build-output assertions; a fresh profile's Welcome tab and chat input swallow the palette shortcut the same way. Disable terminal GPU acceleration so the failure diagnostic works. xterm renders to a canvas when accelerated, so .xterm-rows is empty and the diagnostic claims no terminal was opened while one is plainly open. Wait for deregistration before deleting the temp tree. Deployment holds handles on the loose layout under bin, and each scaffold gets a fresh GUID identity, so anything left behind accumulates instead of being overwritten. Verified by mutation: dropping the configuration setting and emitting an unknown flag each fail these tests, and the diagnostic reports the generated command line and the CLI's error. Co-authored-by: Copilot App <[email protected]>
Cleanup was best-effort: it warned and moved on when the scaffolded app could not be deleted. Every scaffold generates a fresh GUID identity and a fresh temp directory, so nothing is ever reused and anything left behind accumulates -- a registered MSIX package and ~15MB of build output per run, reported only by a warning in the middle of passing output. Wait for the app to actually exit before deleting. Stop-Process returns before the process is gone, and until it is the app still holds handles on its own build output, which is what made the earlier deletions fail. Verify each step and fail the run if anything survives, naming the specific resource. A test that creates real packages and real processes should not be able to leave them behind and still report success. Sweep residue from runs that crashed before their own cleanup, unregistering any package found there rather than just deleting the directory -- an orphaned package is otherwise permanent. Only warn for that residue: a killed run can leave VS Code holding its profile directory, which the current run cannot remove and is not responsible for, and failing would report a stale crash as a failure of whatever happened to run next. Verified by planting an orphaned scaffold and confirming the sweep reclaims it, and by forcing removal to fail and confirming the run fails with each leaked resource listed. Co-authored-by: Copilot App <[email protected]>
E2E_USE_INSTALLED_EXTENSION was inert. The launch args passed --disable-extensions unconditionally, which disables installed extensions; only --extensionDevelopmentPath is exempt from it. Setting the variable therefore disabled the very build it was meant to exercise, and the winapp commands simply did not exist. Name the interfering extensions individually in that mode instead, and keep the blunt flag for the development path where it is correct. Co-authored-by: Copilot App <[email protected]>
The CLI accepts --project when the input is a solution *or* a directory with multiple runnable app projects, but the extension only prompted for solutions. A directory input with several projects was passed through unresolved, and the run stopped at a CLI error telling the user to pass a flag the UI never offered. Read the directory's top-level projects and reuse the same prompt. Only the top level is considered, matching the CLI's own rule. Also harden run-target-picker.spec.ts, which typed into the command palette blind. A first-run sign-in dialog now takes focus on a fresh profile and swallowed the shortcut, so the suite failed for a reason unrelated to what it tests; it passed previously only on timing. Co-authored-by: Copilot App <[email protected]>
Moves the whole VS Code run flow out of extension.ts into a new run-utils module, and the debug-config mapping into run-options, so the palette command and the debug adapter share one pipeline instead of two drifting copies. extension.ts drops ~630 lines. Discovery and prompting: - Skip node_modules/.git/.vs/.idea/packages/.winapp when scanning for projects, using a base list shared with project detection. The base is deliberately narrow so build-output discovery keeps bin/ and artifacts/. - Hide class libraries and test projects from the picker. The heuristic is one-sided: a project is hidden only when it explicitly says so. A missing OutputType stays visible, because the CLI resolves it through full MSBuild evaluation and can see defaults a static parse cannot. - Cap the list at 10 targets and point at Browse for the rest. - Only prompt for --project when two or more plausible candidates remain. The CLI auto-selects a lone runnable app and produces a better error than the extension could, so prompting there is worse than not prompting. - Reuse solution members parsed during discovery instead of re-reading the solution file. - Warn before opening an unbidden folder dialog when discovery finds nothing. Debug adapter: - Resolve a relative input against the working directory before classifying it. A relative project directory was classified against the extension host's cwd, fell through to folder mode, and failed with "does not contain any .exe files". - Route the F5 no-input fallback through the same project disambiguation as the palette, so launching a multi-app solution no longer omits --project. - Stream CLI output to the WinApp output channel, make the launch notification cancellable, and surface build failures with "Show Output" rather than dumping a build log into a toast. Also: - Add a --detach toggle to the advanced command, which the README already promised. - Separate the live-run scaffold prefix from the VS Code profile prefix, and require a Package.appxmanifest before terminating a process by directory name. The orphan sweep could otherwise match a stranded profile and try to stop unrelated processes named after profile subdirectories. - Skip the live-run afterAll sweep when the suite is disabled. - Enable E2E_LIVE_RUN in the release pipeline; the test self-skips when the .NET SDK or WinUI template is missing. - Clarify that winapp.run.* settings apply to the palette commands only. Co-authored-by: Copilot App <[email protected]>
The static classification only exists because winapp run cannot be asked what it considers runnable without also building and launching the app. Record that constraint and the tracking issues at the definition so the heuristic is not mistaken for a reimplementation of the CLI's logic. Refs microsoft/winappCli#957, #273 Co-authored-by: Copilot App <[email protected]>
A directory holding two apps and a library is the one case where the CLI's ambiguity message is unfiltered: it names the library as a candidate, and --project <library> then fails with 'is not a runnable project'. The solution path filters correctly. Lock in that the picker offers only the two apps here. Refs microsoft/winappCli#958 Co-authored-by: Copilot App <[email protected]>
Probed winapp 0.6.1 with `run <input> --no-build`, which prints the resolution decision without building or launching, across nine directory shapes and four solution shapes. Our prompt/no-prompt decision agrees with the CLI everywhere except when every candidate is explicitly a library or test project: the CLI rejects that input outright, while the fail-open rule still offers the list. Documents the trade-off at the test that pins the behaviour so the divergence reads as measured rather than overlooked. Comment only. Co-authored-by: Copilot App <[email protected]>
The runnability filter previously failed open: when every candidate was a library or test project it returned the whole list unchanged, so the picker offered projects the CLI would certainly reject. Picking one produced "is not a runnable project", and a lone library was worse still -- it auto-selected, degraded to folder mode, and reported "Manifest file not found", which says nothing about the real problem. The fail-open rule was guarding the wrong case. Anything the heuristic is unsure about already classifies as `unknown` and survives, so an empty result is the confident one: every candidate explicitly declared itself a library or a test project. Return it, and let callers route to something that can work. Discovery now presses on to the build-output scan when every project is filtered out, so `winapp run <build output folder>` stays reachable in a library-only workspace, and only warns once that scan also comes up empty. Within a chosen solution or directory the empty list means no prompt and no --project, leaving the CLI to report precisely why nothing ran. Verified against winapp 0.6.1 across nine directory shapes: the four that previously offered a doomed pick now route to folder mode instead, and the five runnable shapes are unchanged. Co-authored-by: Copilot App <[email protected]>
The prose covered every rule but required reading a dense paragraph to answer "what will this do in my repo". Adds a table keyed by workspace shape, including the non-.NET cases that can only run in folder mode (Electron, Rust) and the WinUI app that also has stale build output. Calls out the two things that surprise people: a project always beats its own build output, so a workspace holding both builds rather than launching what is there; and folder mode auto-detects a manifest but never generates one, which is what Electron and Rust workspaces hit first. Co-authored-by: Copilot App <[email protected]>
The README table describes how the run target resolves for each kind of workspace, but four of its rows had no test behind them: a project that outranks its own build output, a project-less app such as Electron or Rust, and the two solution outcomes that decide whether --project is prompted for. Adds four e2e tests and two unit tests. The skip-list tests assert both halves of the deliberate asymmetry between project discovery and the executable scan, since that asymmetry is the only reason folder mode is reachable for apps with no project file. Co-authored-by: Copilot App <[email protected]>
The checked-in run schema fixture was pinned to 0.6.1, which turned out to be a prerelease: download-cli.ps1 -Tag latest selects the latest stable, and that has been 0.7.0 since 2026-09-24. The extension was already shipping 0.7.0 behind a 0.6.1-shaped contract test - the same drift this branch exists to close, one version later. - Add scripts/sync-run-schema.ps1, which generates the fixture from the bundled CLI's own --cli-schema output, plus a -Check mode for CI. The fixture is now generated, never hand-edited. - Add a contract suite that re-reads the schema from bin/ and fails on drift. CI downloads latest stable before test:unit, so this runs against latest there; it skips itself when bin/ holds no CLI. - Surface the two options 0.7.0 added to run: --aot and --without-alias, through run-options, RUN_TOGGLES, and the launch.json contribution. --without-alias is launch.json only, since a checkbox opposite --with-alias invites a selection validation must then reject. - Rewrite every launch.json description to state mode applicability and default. - Correct the F5 guidance in the vsce-testing skill, which still described launch.json's deprecated inputFolder key as the only way in. - Fix the e2e README's stale test count for run-target-picker (4 -> 11). Co-authored-by: Copilot App <[email protected]>
readSolutionProjectPaths filtered solution members with a lexical-only check, while project-resolver already paired the same lexical test with fs.realpath. The weak copy was the anomaly, not the strong one: a junction living inside the solution directory passes a lexical test, because nothing in "link\App.csproj" reveals that it redirects outside. Promote the realpath-backed rule into project-detection, the leaf module both already depend on, and have both callers use it. project-resolver keeps its named wrapper so its call sites still read in workspace terms. Add a regression test that creates a real NTFS junction. It fails against the lexical filter and passes against the new one, so it tests the rule rather than restating it, and skips itself where junction creation is unavailable. Co-authored-by: Copilot App <[email protected]>
The runnability heuristic and the .slnx reader both read XML with regular expressions, which hid runnable projects rather than merely missing them: a commented-out <OutputType>Library</OutputType> classified the project as a library and dropped it from the picker, violating the module's own rule that it may never hide something runnable. Single-quoted attributes were invisible, entities went undecoded, and commented-out .slnx members appeared as phantom projects. src/xml-read.ts wraps the @xmldom/xmldom parser already used by the manifest schema code; malformed input now degrades to "unknown", which keeps the project visible. A directory target holding a solution one level down read as having no projects at all, so a browsed directory never reached the --project prompt and the CLI reported the ambiguity instead. readTargetProjects now looks for a top-level solution first and reads its members, matching winapp 0.7.0, which resolves All.sln even when Top.csproj sits beside it. It moved to run-target.ts to be unit-testable; run-utils.ts imports vscode and so cannot be. Project-only options reaching a folder run were a silent no-op: the CLI parses --configuration against a build output folder and ignores it, so a launch.json asking for Release built nothing and said nothing. The adapter now clears them and resolveDebugConfiguration surfaces the warning instead of discarding it. Co-authored-by: Copilot App <[email protected]>
Validation for the project-mode build options was written from the CLI help text rather than from the CLI's behaviour, and three rules were wrong. Each was re-probed against the bundled winapp 0.7.0 and corrected. --aot was being dropped with a `will be ignored` warning on a folder target, alongside the eight options whose help says `Ignored in folder mode`. The CLI actually rejects it outright. Silently dropping it would have run a non-AOT build the user never asked for, so it is now an error and is no longer cleared. --arch was matched case-sensitively against x64/arm64/x86. The CLI compares case-insensitively and also understands amd64, so `--arch X64` and `--arch amd64` were being turned into extension-only errors for builds the CLI would have run. --runtime accepted bare `win`, which the CLI rejects with `Could not determine an architecture from --runtime` because there is no architecture to derive. The check now mirrors what the CLI resolves: win + optional version digits + a supported architecture. The value tests now enumerate the probed accept and reject cases for all three options, and pin the free-form configuration behaviour. New contribution tests assert the arch enums in settings and launch.json stay in step with the validator, and a live e2e proves winapp.run.properties reaches MSBuild and winapp.run.arch reaches the CLI. Co-authored-by: Copilot App <[email protected]>
The contract test compared buildRunArgs against a checked-in snapshot of `winapp --cli-schema`. That snapshot could only ever be as fresh as the last time someone remembered to regenerate it, so it needed a second suite guarding it against the real binary, a script to rewrite it, and a third command to verify it -- three moving parts whose only job was to keep a copy honest. bin/ is gitignored but CI downloads the CLI before npm run test:unit, so the binary is already present wherever this contract is enforced. Reading the schema from it directly makes drift impossible by construction rather than detectable, and deletes the snapshot, the sync script, and both npm scripts. The suite now skips with a visible reason when bin/ is empty, which is the only case the snapshot really covered: a fresh clone that has not run npm run download-cli. Co-authored-by: Copilot App <[email protected]>
The note said the test `also covers the deprecated inputFolder alias` without ever saying what the alias is an alias for, so it only made sense to someone who already knew `input` replaced `inputFolder` when run gained project mode. State that relationship, and why the error message deliberately echoes back whichever name the user wrote rather than the canonical one. Co-authored-by: Copilot App <[email protected]>
Every validateRunInput folder-mode test passed kind 'folder', but classifyRunTarget only returns 'folder' for a directory that already contains an .exe. A directory with no .exe reaches validation as 'unknown', so the suite was exercising a combination production cannot produce and skipping the one it does. Add 'unknown' cases for the no-exe, has-exe, and missing-path branches. Co-authored-by: Copilot App <[email protected]>
The paragraph spelled out the skip list, the 10-target cap, the library and test project filtering, and the second project prompt - all of which the workspace-shape table directly beneath it already covers row by row. State the behaviour in three sentences and let the table carry the detail. Co-authored-by: Copilot App <[email protected]>
The nine-row table and its two callouts walked through every workspace layout one at a time, which is reference material rather than the orientation a README owes a reader. Keep one sentence of it: folder mode needs a Package.appxmanifest, which is a hard failure for Electron and Rust users and is documented nowhere else in the repo. Co-authored-by: Copilot App <[email protected]>
Recast eight sentences to use commas, semicolons, parentheses, or a full stop instead. Co-authored-by: Copilot App <[email protected]>
Electron, Rust, and C++ apps have no project file to point input at, so `if you prefer to keep pointing at a build output folder` described a choice they do not have. Say when folder mode applies instead, and note that these apps always use it. The preLaunchTask example was also labelled `example for .NET`, which is the one stack that does not need it. Note that any build command works. Co-authored-by: Copilot App <[email protected]>
The first configuration sets no input, so the extension auto-discovers the project and builds it. For a single-project workspace the second configuration did exactly the same thing at twice the length. The properties table below already documents input and configuration. Co-authored-by: Copilot App <[email protected]>
The row's trailing clause made it unclear whether the multi-app condition applied to solutions or only to directories. Use the CLI's own phrasing, which also notes the value may be a name or a path. Co-authored-by: Copilot App <[email protected]>
Verified against the bundled CLI: a folder holding only AppxManifest.xml registers fine, so naming Package.appxmanifest as the sole filename was too narrow. Co-authored-by: Copilot App <[email protected]>
Also state how the two palette commands consume them: Run Application applies them silently, Advanced seeds its prompts from them. Co-authored-by: Copilot App <[email protected]>
306d171 added an unrestricted mode so a browsed solution outside every workspace folder keeps its `..` members. That early return skipped the whole containment check, and the old check had been rejecting rooted paths lexically as a side effect of `path.relative`. A crafted .slnx naming a UNC member therefore survived to filterOfferableProjects, whose readFile authenticates to that host before the user answers the project picker. Reject rooted, UNC and drive-relative members on the raw entry instead, in both modes: a real solution always names its members relatively. Co-authored-by: Copilot App <[email protected]>
…onfiguration prompt Containment was anchored to the workspace root, so opening `repo/solutions` as the folder dropped every `..\src` member: the --project prompt silently vanished and the CLI was handed an ambiguous solution. The same symptom the browsed case hit. Anchor to the solution's parent directory instead, which is what the `solutions/` + `src/` layout actually needs, and let a workspace root only widen that. `unrestricted` and `rootIsSynthesized` existed to special-case the browsed path and are no longer needed. The junction test now points two levels up, so it still proves a reparse point cannot buy reach a plain `..` would not. --configuration is an open string and launch.json already declares it as one, but the prompt was a closed Debug/Release list with no way to name Staging or to defer to the project default. Offer those two as rows, accept anything typed, and add a Default row. The with-alias help was also wrong in three places: CLI 0.7.1 stages the uap5:ExecutionAlias itself, so no manifest edit is required. Co-authored-by: Copilot App <[email protected]>
The directory containment rule on solution members is removed. Its boundary could only ever be guessed from how deep the solution happened to sit, so it was vacuous near a drive root and wrong for a solutions/ + src/ layout, where it discarded every member, skipped the --project prompt and handed the CLI an ambiguous solution. That bug recurred in three consecutive commits. `winapp run App.sln` builds whatever MSBuild resolves regardless, so filtering members prevented no execution - it only hid choices. The rooted/UNC/drive-relative rejection stays: that one blocks a crafted solution aiming readFile at an attacker host. The picker no longer truncates to ten targets. A QuickPick filters only over the items it was given, so targets past the cap could not be reached by typing; the scan is already bounded by PROJECT_FILE_MAX_RESULTS. The e2e test now asserts typing reaches the thirteenth project, and it fails against the previous bundle. The Default configuration row said `the project's default configuration`; the CLI pins Debug. Co-authored-by: Copilot App <[email protected]>
run-target-picker.spec.ts defines 15 tests, not 14: the symbols/debug-output coupling test had no row, so the suite heading and the 226 total were both one short. A contributor changing that prerequisite would have read the table and concluded nothing guarded it. Co-authored-by: Copilot App <[email protected]>
Under --json the CLI keeps stdout for the payload and sends human-readable output to stderr, which in project mode is dotnet build passthrough. Tailing it parked the notification on 'Time Elapsed 00:00:15.11' for the whole register-and-launch phase, reporting on the build that had already finished instead of what the run was doing. Skip MSBuild's summary block so the last line naming a phase survives -- 'Build succeeded.', or 'Build FAILED.' when it does not. The reader also buffers partial lines, since a line split across stderr chunks was both unreadable and able to slip past the filter. Verified against the live CLI: the notification now ends on 'Build succeeded.' Co-authored-by: Copilot App <[email protected]>
Nikola Metulev (nmetulev)
left a comment
There was a problem hiding this comment.
Thanks for this! I ran it for real: packaged extension with the bundled CLI (v0.7.1), in VS Code alongside the C# extension and C# Dev Kit, against Daylight (single .csproj), AI Dev Gallery (.sln, 5 projects) and WinUI Gallery (.slnx). The core flow is in good shape:
- F5 project mode built, launched and attached
coreclron all three (Daylight ~43s, AI Dev Gallery ~99s including build, WinUI Gallery ~113s cold / ~21s warm)..slnxwith noprojectauto-picked the only runnable app, andpropertyoverrides were forwarded correctly. - Legacy
inputFolderconfigs still debug. detach/noLaunch/debugOutputare rejected before the CLI runs.- The "Launching package..." notification streams build progress and Cancel works.
- "Run Application With Options" (target, configuration, arch, toggles) produced the expected
winapp run ... --no-build --detachin a terminal.
A few things need to change before we ship.
Must fix
-
Pin the CLI and run the contract test against the binary we ship.
download-cli.ps1defaults tolatestin bothbuild.ymlandrelease-vsc.yml(CliReleaseTagdefaults to empty).run-cli-contract.test.tsonly runs in PR CI against whateverlatestwas at the time, never in the release pipeline against the binary we package and sign. It also means every upstream CLI release can turn unrelated PRs red. Please keep one pinned CLI version that build, CI and release all read, and add a blocking contract-test step in release afterpackage-vsc.ps1. -
.vcxprojsupport.PROJECT_FILE_EXTENSIONSinsrc/run-target.tsis['.csproj']only, but CLImain(0.7.2) accepts C++.vcxprojin project mode. Once that CLI ships,launch.jsoninputs pointing at C++ projects are rejected ("contains no project or .exe files"), C++ apps are never offered in the picker,.vcxprojsolution members are dropped, and the contract test fails. Please add.vcxproj, treating runnability as unknown since the classifier is .NET-specific. -
unregisterOnExitdoesn't unregister under F5. I tried both pressing Stop and closing the app window, and the package stayed registered both times. Part of this is a CLI bug: runningwinapp run Daylight.csproj --unregister-on-exitdirectly and closing the app also leaves it registered ("Could not determine which package ... was registered, so it was left registered", on both 0.7.1 and 0.7.2). But the extension also defeats it: teardown inextension.ts(~L1104-1128) callsrunProcess.kill()as soon as the child session ends, so the CLI never reaches the unregister step. Please let the CLI exit on its own with a short timeout before force-killing (and usekillProcessTree), and either dropunregisterOnExitfrom the debug schema or reject it invalidateDebugRunOptionsuntil the CLI side is fixed. The CLI side needs its own bug in winappCli.
Should fix
-
No automated coverage of the F5 project-mode attach path. Nothing tests
launchRunProcess(PID parsing across chunks, cancel, kill, failure), and the F5 E2E inrun-target-picker.spec.tsstops at the picker on purpose. An opt-in live test that setsinputto a.csprojand asserts a child debug session starts would catch most regressions. -
Failure toast only shows the exit code.
run-exit.tsproduces "winapp run failed with exit code 1." The last meaningful stderr line (build failure or the CLI's error) is already available and would make the toast actionable. -
aotwith the defaultcoreclrdebugger. A Native AOT process has no CLR, so the attach fails and the user is then pointed at installing a different debugger extension. Please default tocppvsdbgwhenaotis set, or reject the combination with a clear message. -
Nothing is remembered between runs. F5 without
inputre-scans and re-prompts every time, and Run With Options starts from scratch each run. Offering "Save to launch.json" after an interactive pick, or remembering the last answers inworkspaceState, would remove most of the repetition. Step titles/counters on the prompt chain would help too.
Follow-ups (fine after merge)
- The palette path turns argv back into a PowerShell string for
terminal.sendText. Running it throughProcessExecutionlikerunWinappTooldoes would drop the escaping layer entirely. - The runnability heuristics in
project-detection.tsandrun-target.tsmirror the CLI's rules. It would be good to put them behind one interface and swap in the CLI's own project query once microsoft/winappCli#957 lands.
|
Correction to item 3 ( I rebuilt the CLI from |
Zach Teutsch (zateutsch)
left a comment
There was a problem hiding this comment.
🤖 AI-generated review (WinAppVSCE pr-review skill) — verify before acting.
Thanks for the thorough round of fixes. I re-ran the build, the unit tests and a live harness pass against 616adcb. Most of the previous feedback is resolved and verified live:
- The U+2019 injection repro no longer runs.
samples/winui-solutionauto-selectsWinUISolution.slnxwith no picker and no--projectprompt. The CLI then picks App.
Two regressions remain, both reproduced live in an isolated VS Code instance.
Must fix
1. Cancelling F5 still produces a modal error dialog. I opened a workspace with two WinExe projects and a launch.json with no input, pressed F5 and then Escape on the picker. Result: a modal dialog saying "No run target selected, cancelling debug session." with an "Open 'launch.json'" button.
- Cause:
DebugLaunchCancelledis a plainError. VS Code's debug service suppresses only real cancellation errors (name === message === 'Canceled'). Anything else goes toshowError, a modal prompt. - Affected paths: the target picker, the new project-in-solution picker, and Cancel on "Launching package...".
- Fix: throw
new vscode.CancellationError(), or haveDebugLaunchCancelledsetnameandmessageto'Canceled'. - Also remove the README troubleshooting row that documents the cancel message as an error.
2. Native C++ solutions are auto-picked and always fail. I opened a workspace with App.sln (listing only App\App.vcxproj) plus x64\Debug\App\{App.exe, AppxManifest.xml} and ran WinApp: Run Application. Result: no prompt. The terminal ran winapp run '...\App.sln', which failed with ❌ No .csproj projects were found in 'App.sln'.
- Cause:
filterOfferableCandidatesnever drops solutions. The.slnis therefore the only candidate and is auto-selected, and the build-output fallback never runs. - The CLI falls back to folder mode only for a directory input, not for an explicit
.sln. - The released extension ran these apps from the build-output picker, so this is a regression for every C++ user (palette and F5).
- Fix: in
discoverRunTargets, drop solution candidates whose.csprojmember list is empty, so native-only workspaces reachfindBuildOutputTargets.
PR description (becomes the squash message)
- The usage example still sets
"debugOutput": trueand"symbols": true. F5 rejectsdebugOutput, so copying the example fails. The bullets also claim launch.json covers options the debugger schema intentionally omits. - Please also mention the F5-without-launch.json provider, the activation-time "add a launch configuration" notification, and the new
javascript/typescriptdebugger languages.
What was exercised
scripts/build-vsce.ps1 -Package: OK.npm run lint: 0 errors.npm run test:unit: 1422 + 37 passing.- Live harness on the packaged VSIX: injection retest, winui-solution, F5 cancel, and the native C++ solution.
Not exercised: a real F5 attach to a running app.
Make F5 cancellation recognizable to VS Code, keep native-only solutions on the folder-mode fallback, and require the native debugger for AOT launches. Pin the bundled CLI in one checked-in file and verify the release contract against the exact packaged binary. Add a live WinUI F5 attach test alongside the existing palette runs. Co-authored-by: Copilot App <[email protected]>
|
Addressed the current review in
I left Deferred follow-ups are tracked in #297, #298, #299, and #300. Validation: full |
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Description
Resolves #306
The extension's run surface was designed against winappcli ~v0.3.1, while the build and release automation downloaded a newer CLI.
winapp rungained a full project mode (accepting a.csproj, a.sln/.slnx, a.cs.NET file-based app, or a directory containing one) alongside the existing folder mode, plus build and launch options that were unreachable from VS Code.Before this PR,
winapp.runonly scanned for folders containing.exefiles and invokedrun <folder>with no options. The debug adapter hardcoded['run', inputFolder]and surfaced only the legacy folder-mode fields.This PR:
.sln/.slnxmigration pairs collapse to.slnx, and native-only solutions fall back to their built.exeoutput while the pinned CLI supports only.csprojsolution members.--project,--configuration,--arch,--framework,--runtime,--property,--no-build,--no-restore,--aot. Both modes:--clean,--debug-output,--symbols,--detach,--no-launch,--unregister-on-exit,--with-alias,--without-alias,--executable.launch.json, avoiding a second workspace-settings source.winapplaunch schema covers project mode and compatible options, keepsinputFolderas a deprecated alias, rejects options that cannot coexist with VS Code attachment, selects/requirescppvsdbgfor Native AOT, and attachescoreclr,cppvsdbg, or the built-in Node debugger as configured.launch.json. A dynamic configuration provider supplies the default F5 configuration, target discovery prompts wheninputis absent, and an activation-time notification can add the default entry to.vscode/launch.json.javascriptandtypescriptin addition to C# and C++.cli-version.jsonis the single default for local builds, PR CI, and release packaging. The release pipeline runs the run-surface contract test against the exact binary copied into the VSIX. The current pin is v0.7.1.Time Elapsed.Validation remains with the CLI wherever it can report the authoritative error. The extension validates only structural problems it must handle before launch (for example, no attachable process or an AOT/debugger mismatch).
Usage Example
Project mode from
launch.json:{ "type": "winapp", "request": "launch", "name": "WinApp: Launch (Release, arm64)", "input": "${workspaceFolder}/src/MyApp/MyApp.csproj", "configuration": "Release", "arch": "arm64", "debuggerType": "coreclr" }For Native AOT, set
"aot": trueand use"debuggerType": "cppvsdbg". For a one-off run with options that are incompatible with debugger attachment (debugOutput,symbols,detach, ornoLaunch), use WinApp: Run Application With Options instead of F5.Related Issue
Type of Change
Checklist
.\scripts\build-vsce.ps1locallypackage.jsoncontribution points / command/debugger/custom-editor docs updated (if extension surface changed)Additional Notes
Validation at commit
bab9e9a:.\scripts\build-vsce.ps1 -Packagenpm run lintcurlywarnings)npx tsx --test src/test/run-cli-contract.test.tsnpx playwright test src/test/e2e/run-target-picker.spec.ts --project=vscode --reporter=list$env:E2E_LIVE_RUN=1; npx playwright test src/test/e2e/live-run.spec.ts --project=vscode --reporter=listcoreclrattach, and With Options Release/x64 buildThe live suite scaffolds unique WinUI apps, asserts registration/process/build output, and removes the app, package registration, workspace, and VS Code profile after each run.
--propertyremainslaunch.json-only because MSBuild properties are project-specific durable configuration rather than a useful value to retype in the one-off prompt chain.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.