microsoft / microsoft/WinAppVSCE
XAML server: in-flight project loads can cache a pre-invalidation graph
@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
keywithout waiting. - Alternatively, re-check
ContainsProjecton completion and self-evict, rather than eviction at invalidate time. - Either way, do not dispose a cached workspace task that active
ResolveAsynccallers may still be awaiting — that hazard exists today even for the same-key path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.