Skip to content

Fix C++/WinRT response-file paths containing spaces - #1174

Open
leileizhang (lei9444) wants to merge 1 commit into
mainfrom
lei9444-cpp-response-file-paths
Open

leileizhang (lei9444) wants to merge 1 commit into
mainfrom
lei9444-cpp-response-file-paths

Conversation

@lei9444

Copy link
Copy Markdown
Contributor

What and why

Fixes C++/WinRT header generation when a project folder contains spaces. The response file (the file containing the tool's options) was passed as an unquoted command string. Its path could be split into several arguments. Pass @ and the complete path as one argument instead.

Before / after

To reproduce on Windows with access to the SDK package feed, create a native project in a folder containing spaces, then initialize it:

New-Item -ItemType Directory '.\project with spaces'
Set-Content '.\project with spaces\main.cpp' 'int main() { return 0; }'
winapp init '.\project with spaces' --use-defaults

Actual before: the C++/WinRT step receives a split response-file path and fails with cppwinrt execution failed.

Expected after: @...\project with spaces\.winapp\include\.cppwinrt.rsp reaches the tool as one argument, so spaces do not prevent header generation.

The screenshots show the isolated regression, not a full init run. It uses a batch stub that rejects a second argument. The same test fails against the main implementation and passes with this fix.

Before: main implementation + regression After: fixed implementation + regression
The path-with-spaces regression fails with cppwinrt execution failed and exit code 2 The same path-with-spaces regression succeeds with exit code 0

Not tested / risks

The full SDK download and winapp init workflow was not run. The repository build published the x64 CLI, then stopped at ARM64 with Platform linker not found; this machine has no ARM64 C++ build tools. Package builds and CI are not verified locally.

Checklist

  • Tests added or updated
  • Tested locally on Windows
  • Docs, samples, and plugins/winapp/skills/ updated if user-facing behavior changed — N/A: this restores existing behavior without changing commands or workflow.
Notes for reviewers

Local validation used a process-scoped NuGet configuration:

# Passed: 0 warnings, 0 errors.
dotnet build .\src\winapp-CLI\WinApp.Cli.Tests\WinApp.Cli.Tests.csproj -c Release -p:RuntimeIdentifiers=win-x64 -p:PlatformTarget=x64 -p:PublishAot=false -p:PublishSingleFile=false -p:SelfContained=false -p:UseSharedCompilation=false -warnaserror --nologo

# Passed: 16 tests, 0 skipped (service behavior and signature verification).
.\src\winapp-CLI\WinApp.Cli.Tests\bin\Release\net10.0-windows10.0.19041.0\WinApp.Cli.Tests.exe --filter 'FullyQualifiedName~CppWinrt'

# Failed at ARM64 publish: missing platform linker; x64 publish succeeded.
.\scripts\build-cli.ps1 -SkipAll

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 10:45
@lei9444 leileizhang (lei9444) added the agent-preparing Agent is addressing feedback or completing required validation and CI label Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow fix uses standard argument handling and covers the original failure with a regression test; no blocking issues were identified.

No open issues 🎉

What changed in this PR

Fixes C++/WinRT header generation for project folders containing spaces by passing the response-file path as one process argument.

Changes:

  • Uses ArgumentList to preserve the complete response-file path.
  • Adds a regression test that rejects split arguments and checks the received path.
File Description
src/​winapp-CLI/​WinApp.Cli/​Services/​CppWinrtService.cs Passes @ and the full response-file path as one argument.
src/​winapp-CLI/​WinApp.Cli.Tests/​CppWinrtServiceTests.cs Tests response-file argument handling for paths containing spaces.

Review effort: Balanced

@lei9444 leileizhang (lei9444) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 23, 2026
leileizhang (lei9444) added a commit that referenced this pull request Oct 23, 2026
Restore native sources and tests to main and keep the WinUI sample focused on the counter.
The C++/WinRT response-file fix and space-path regression are tracked separately in #1174; Python workflow fixtures use ordinary directory names.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Build Metrics Report

Validation passed. All required build and validation jobs succeeded.

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 65.05 MB 65.06 MB 📈 +15.5 KB (+0.02%)
CLI (x64) 64.97 MB 64.99 MB 📈 +13.5 KB (+0.02%)
MSIX (ARM64) 26.93 MB 26.93 MB 📈 +4.0 KB (+0.01%)
MSIX (x64) 28.55 MB 28.56 MB 📈 +10.9 KB (+0.04%)
NPM Package 56.12 MB 56.12 MB 📉 -0.0 KB (-0.00%)
NuGet Package 56.27 MB 56.28 MB 📈 +9.7 KB (+0.02%)

.NET Test Results (TRX reports)

Other suites are reflected in the overall validation status above.

✅ 10670 passed, 43 skipped out of 10713 tests in 1838.6s (+6 tests, -745.7s vs. baseline)

Test Coverage

✅ 87.4% line coverage, 81.5% branch coverage · ✅ no change vs. baseline

CLI Startup Time

54ms median (x64, winapp --version) · ✅ -6ms vs. baseline

Try This Build

Installs the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing.

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 1174
Switching between builds often?

Put the tool on your PATH once:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPath

Then this build is just:

winapp-pr 1174

Run winapp-pr with no arguments to pick from a list of open PRs.


Updated 2026-10-23 11:22:34 UTC · commit 47a7ade · workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants