Repository navigation
Release project snapshots when their project leaves the workspace - #20762
xperiandri wants to merge 6 commits into
Conversation
✅ Release notes checked
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Late work from a reloaded solution can repopulate the cache when project IDs are preserved.
2 open findings
What changed in this PR
Releases transparent-compiler snapshots when projects leave the Visual Studio workspace, preventing old Roslyn solutions from remaining rooted.
Changes:
- Adds project and solution lifecycle cache eviction.
- Guards against late snapshot completion and adds regression tests.
- Documents the memory-leak fix in release notes.
| File | Description |
|---|---|
ProjectSnapshotCacheTests.fs |
Tests snapshot eviction behavior. |
FSharp.Editor.Tests.fsproj |
Includes the new tests. |
WorkspaceExtensions.fs |
Centralizes and evicts snapshot caches. |
LanguageService.fs |
Hooks cache eviction into workspace and solution events. |
18.vNext.md |
Adds the release note. |
🧠 Review effort: Balanced
T-Gro
left a comment
There was a problem hiding this comment.
The diff is still way too big - apply the NoBloat instructions and CodeCompaction skill.
Especially the massive code comments would benefit not just with drastic reduction, but ideally with well named functions/arguments/bindings/types making the intention clear.
If a well named piece of code just tells what the comment says - delete the comment.
- This diff adds 14 new code comment lines and 1258 new code comment chars.
- Comments bypass the type system and become stale maintenance state. Keep only durable public contracts; express implementation intent through names, functions, active patterns, discriminated unions, and types.
With the transparent compiler on, the editor keeps the last snapshot of every F# project it has built one for, and a memoized snapshot per Roslyn project version. Each holds the Roslyn `Project` it was built from, and through it the whole `Solution`. Nothing removed them: the dictionary of last snapshots only grew, so every solution opened in a session stayed reachable until Visual Studio exited. Both stores now live in ProjectSnapshotCache and follow the workspace. A project's entries go when the workspace reports it removed, the old solution's projects go when the solution is removed, cleared or reloaded, and closing the solution clears everything, next to the other caches. A snapshot requested for a project that has already left is stored first and checked after, so late work cannot bring an entry back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wait is for an event the workspace raises from the thread pool. In a full run of the editor tests the pool can take longer than ten seconds to start queued work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the id A snapshot being built when its project left was dropped afterwards if the workspace no longer held the project's id. A reload brings the same ids back, so the check let the build of the old solution's project keep its entries, and with them the old Project and its solution, until the next snapshot of that id replaced them. The cache now counts the removals the workspace reports. A request notes the count when it starts and, when it moved by the time the build ends, forgets the project's entries; the next request builds them again. The tests hold the request on the text of the document, a loader the test releases, and remove the project, or clear the solution and add it again under the same ids, while the request is pending. With the id check the reload test fails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4ba5f1d to
3015cbf
Compare
T-Gro
left a comment
There was a problem hiding this comment.
🤖🕵️ AI review — verify independently.
…after the removal The forget that follows a removal ran only when the request completed, and a request begun after the project left the workspace stored its snapshot again. The forget now runs in a finally block, the store checks the workspace first, and the comments are replaced by the names that carry what they said. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Addressed the NoBloat / CodeCompaction review in
The three new tests fail when the |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


With the transparent compiler on, the editor kept the last snapshot of every F# project it had built one for and never dropped any. Each holds the Roslyn solution it was built from, so every solution opened in a session stayed in memory until Visual Studio exited. Snapshots are now released when their project is removed and when the solution is closed.
Details
ProjectRemoved, the old solution's projects onSolutionRemoved,SolutionClearedandSolutionReloaded. Closing the solution clears everything, next to the other caches.🤖 Generated with Claude Code