microsoft / microsoft/WinAppVSCE

XAML server: in-flight project loads can cache a pre-invalidation graph

Open
#215 1 comment 0 reactions 1 assignee View on GitHub

@chiaramooney is already working on this.

Since Sep 8, 2026.

Dominant language
TypeScript
Stars
13
Forks
3
Avg merge
6d 1h
Merged PRs (30d)
11

Description

Found while reviewing PR #50 (originally review finding M4).

XamlProjectResolver.Invalidate (server/src/WinUiXaml.Workspace/XamlProjectResolver.cs:204-239) evicts:

  • the cache entry keyed by the changed project, and
  • completed entries whose Result.ContainsProject(key) is true.

The gap: a load for a different root that is still in flight cannot be tested with ContainsProject, because the project graph does not exist until the load completes. If that pending load turns out to reference the invalidated project, it is cached afterwards with a pre-invalidation graph and is never evicted. In practice this can leave IntelliSense stale until the next edit to that project.

An attempted fix — adding || !pair.Value.IsCompleted to the predicate — was reverted, because it is not scoped to key and therefore evicts every in-flight load across all roots. That caused worse problems: DisposeWhenComplete would dispose a RoslynProjectWorkspace that other callers were already awaiting in ResolveAsync, plus duplicated MSBuild design-time loads, plus a possible no-progress loop where saves during a cold load repeatedly restart it.

Suggested work:

  • Record each pending load's candidate project set (e.g. the project paths known at load kickoff) so pending entries can be tested against key without waiting.
  • Alternatively, re-check ContainsProject on completion and self-evict, rather than eviction at invalidate time.
  • Either way, do not dispose a cached workspace task that active ResolveAsync callers may still be awaiting — that hazard exists today even for the same-key path.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.