Repository navigation
Avoid compilation stalls when source files are deleted - #86286
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the original text-loader retry policy and avoid loading obsolete document states during compilation updates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep focused SolutionTests coverage, clarify test names and scenario blocks, and remove the server-path test additions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Split changed-then-removed and interleaved updates into focused tests. Assert final syntax trees and obsolete loader counts without symbol queries or GC.KeepAlive. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep method names unchanged and move the issue link from the product comment to regression test WorkItem attributes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the changes merging pending source-document updates and removals.
No open issues 🎉
What changed in this PR
Addresses deletion-related compilation stalls in Roslyn’s workspace layer by merging pending source-document updates and removals, avoiding reads of obsolete text.
Changes:
- Uses original syntax trees and final document states to apply merged updates and removals.
- Preserves other translation kinds as merge boundaries, leaving
TextLoaderretry behavior unchanged. - Adds regression tests for removed documents, interleaved updates, and merge boundaries.
| File | Description |
|---|---|
src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs |
Adds loader-count and syntax-tree assertions for merged changes and boundaries. |
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.TranslationAction_Actions.cs |
Unifies update and removal actions and merges affected document IDs. |
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.cs |
Routes source-document updates and removals through the unified action. |
Review effort: Balanced
jasonmalinowski
approved these changes
Nov 2, 2026
Rename the action to UpdateOrRemoveDocumentsAction, remove the deletion-specific merge comment, and use the same setup comment in each regression test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
jasonmalinowski
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #86236
Deletion notifications can invalidate document text before a project reload removes the documents. Applying those pending text updates can load missing files and stall compilation while the text loader retries.
UpdateOrRemoveDocumentsActionmerges consecutive pending source-document updates and removals. It retains the original project state, the final project state, and the affected document IDs. Surviving documents use their final syntax trees. Removed documents have their original trees removed without loading replacement text. Other translation kinds prevent merging, and the text loader's retry behavior remains unchanged.Earlier in-process language-server project-loading verification reduced the semantic-model wait after deleting 20 files from about 20.5 seconds to about 0.6 ms for individual deletions and 14.9 ms for directory deletion. These were individual measurements, not benchmark averages. Those server-specific tests are not retained in the final PR.
Microsoft Reviewers: Open in CodeFlow