Skip to content

Fix XAML IntelliSense build contention and project-state bugs - #371

Merged
Jaylyn Barbee (Jaylyn-Barbee) merged 4 commits into
mainfrom
chiaramooney-xaml-intellisense-fixes
Nov 9, 2026
Merged

Jaylyn Barbee (Jaylyn-Barbee) merged 4 commits into
mainfrom
chiaramooney-xaml-intellisense-fixes

Conversation

@chiaramooney

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

Copy link
Copy Markdown
Collaborator

Description

Fix five XAML IntelliSense reliability issues:

  • Keep design-time outputs and markup snapshots private to each server and root project, including shared project references and projects with explicit output paths. Normal build outputs remain untouched.
  • Preserve the last usable project context while refreshing. Broken markup no longer prevents loading C# project types, failed requests do not repeatedly start builds, and saving repaired markup recovers generated members.
  • Reject rename collisions and reserved C# identifiers without rejecting valid Unicode names. Rename refuses stale project contexts so newly saved code-behind references cannot be missed during refresh.
  • Recheck disk inputs on save and reopen to recover from missed watcher events. Added, removed, or changed package references, including centrally managed versions, require matching restored assets for the selected framework. Package version overrides retain precedence.

Usage Example

With two buttons named First and Second, renaming First to Second or class is rejected before any edits are applied. A valid Unicode identifier remains accepted. Saving a new C# reference and immediately renaming its XAML element refuses safely while the project refreshes, then checks the updated code-behind.

When two applications share a library, opening their XAML pages does not overwrite that library's normal build outputs. Hover and navigation remain available during project refreshes. An ordinary XAML save does not restart the project build.

Changing a package version in Directory.Packages.props without restoring reports restore-required on XAML save. Matching restored assets recover the project context.

Related Issue

Fixes #345
Fixes #346
Fixes #348
Fixes #349
Fixes #350

Type of Change

  • 🐛 Bug fix
  • 📝 Documentation
  • 🧪 Test update

Checklist

  • New tests added for new functionality (if applicable)
  • Ran .\scripts\build-vsce.ps1 locally
  • Tested locally on Windows (if applicable)
  • README.md updated (if applicable): N/A, affected implementation notes are in docs/XAML-AOT.md.
  • CONTRIBUTING.md updated (if contributor workflow changed): N/A.
  • package.json contribution points / command/debugger/custom-editor docs updated (if extension surface changed): N/A.
  • Screenshots or GIFs added for UI changes (if applicable): N/A, nonvisual language-service fixes.

Screenshots / Demo

Nonvisual changes. Regressions exercise real WinUI markup generation, concurrent applications sharing a library, locked user-build output, malformed markup and recovery, rename during refresh, missed watcher events, and central package restore freshness.

Additional Notes

Local Windows validation:

Command Result
npm run compile-tsc Passed; extension sources are unchanged by the follow-up fixes.
npm run lint Passed with 10 existing warnings in unchanged TypeScript files.
npm run test:unit Passed after syncing the required manifest schemas with npm run sync-schemas; extension sources are unchanged by the follow-up fixes.
npm run test:server --silent Passed: 71 parser, 263 workspace, and 989 language-server tests.
npm run test:xaml-smoke --silent Passed, including immediate refresh-time rename rejection, unchanged saves, missed watchers, and central-version restore/recovery.
.\scripts\build-vsce.ps1 -Package Passed before the follow-up fixes; the final package was rebuilt with the command below.
$env:WINUI_XAML_SERVER_BUNDLE_MODE='source'; npm exec --no -- vsce package --out artifacts\winapp-xaml-followup.vsix --pre-release Passed for the final code using existing dependencies; VSIX includes x64 and ARM64 Native AOT servers.
$env:WINUI_XAML_SERVER_BUNDLE_MODE='artifact'; npm run test:xaml-bundled --silent Passed against the final local x64 bundle, including the missing-generator-helper scenario.

The installed final VSIX was driven through the isolated VS Code harness. An unused name remained renameable; after saving a new C# reference, rename refused promptly during a deliberately paused refresh while typed hover remained available. Once refresh completed, the code-behind safety check rejected the rename.

ARM64 was packaged but not executed on this x64 machine. Existing documented Roslyn trim warnings remain visible. NuGet.Versioning provides canonical version-range comparisons rather than a custom approximation.

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.

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

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

⏳ Build in progress — the VSIX size below is from a previous commit and will update when the current build finishes.

VSIX Build

Artifact Baseline Current Delta
VS Code Extension (VSIX) 67.78 MB 67.90 MB 📈 +123.0 KB (+0.18%)

Updated 2026-11-07 00:31:32 UTC · commit 05a54a3 · workflow run

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@chiaramooney Chiara Mooney (chiaramooney) added ready-for-review Agent work and checks complete; awaiting human review and removed agent-preparing Agent work in progress (feedback, validation, or CI) labels Nov 9, 2026
@Jaylyn-Barbee

Copy link
Copy Markdown
Contributor

🤖 AI-generated review (WinAppVSCE pr-review skill) — verify before acting.

PR Review — chiaramooney-xaml-intellisense-fixes vs main

Decision

Changes required. One bug I reproduced: a project folder with one unreadable subfolder now loses XAML IntelliSense entirely.

Must fix

The new project-input walk crashes on an unreadable or vanishing folder

  • What is wrong: CollectFiles walks the project directory with Directory.Enumerate* and has no handling for UnauthorizedAccessException or IOException.
  • Show me: I made a temp folder with App.csproj and a Secrets subfolder, then denied read access with icacls Secrets /deny <me>:(RX). new ProjectInputSnapshot([App.csproj], []) threw System.UnauthorizedAccessException. Expected: skip the folder.
  • Why it matters: That constructor runs at the end of the project load in RoslynProjectWorkspace.cs:226, so the load fails. The same walk also runs on document open (before diagnostics and warm-up) and on save, where a folder deleted mid-walk hits the same exception. Before this PR, project load never walked the directory, so this is a regression.
  • Smallest fix: Wrap the enumeration calls in a catch for those two exceptions and skip the directory. Add one regression test with a denied subfolder.
  • Location: server/src/WinUiXaml.Workspace/ProjectInputSnapshot.cs:69-84

Non-blocking

None.

What was exercised

  • npm run test:server passed: 71, 263 and 989 tests.
  • A temporary probe test with a denied subfolder reproduced the exception.
  • Not exercised: the packaged VSIX in the test harness and npm run test:xaml-smoke. The defect shows up at the unit level, so this doesn't change the decision.

@chiaramooney Chiara Mooney (chiaramooney) added agent-preparing Agent work in progress (feedback, validation, or CI) and removed ready-for-review Agent work and checks complete; awaiting human review labels Nov 9, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@chiaramooney

Copy link
Copy Markdown
Collaborator Author

Jaylyn Barbee (@Jaylyn-Barbee) Fixed in 6f4e4d6. The input scan now catches only IOException and UnauthorizedAccessException when listing directories, checking child attributes, or reading file stamps. It logs the affected path and continues scanning readable siblings instead of failing project load or refresh.

Added Windows ACL regressions covering a subfolder denied before snapshot construction and after construction before HasChanges. Both reproduced the exception before the fix and now pass, while edits in a readable sibling are still detected. Added coverage for a removed project directory with surviving inputs as well.

Validation: the full workspace suite passed (266 tests), and npm run test:xaml-smoke --silent passed. The focused independent review found no significant issues. The packaged VSIX was not rebuilt locally for this fix; fresh CI is pending.

@Jaylyn-Barbee
Jaylyn Barbee (Jaylyn-Barbee) merged commit 8d41064 into main Nov 9, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-preparing Agent work in progress (feedback, validation, or CI)

Projects

None yet

2 participants