Repository navigation
Fix lscache loading issues - #86148
Merged
jasonmalinowski merged 3 commits intoOct 21, 2026
Merged
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
jasonmalinowski
force-pushed
the
fix-lscache-loading-issues
branch
from
October 20, 2026 20:21
9b0625d to
90f8c0b
Compare
dibarbet
approved these changes
Oct 20, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Fallback loading can discard parser-derived references and fail to resolve project-relative analyzer paths.
2 open issues
What changed in this PR
Restores references and document folders during cached language-server project loading, with shared regression-test patterns.
Changes:
- Loads structured metadata and analyzer references, preserving aliases and interop settings.
- Restores cached document folders and updates changed folders after full loading.
- Adds cache-loading and project-update regression tests.
| File | Description |
|---|---|
| src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.Worker.cs | Consumes structured references. |
| src/Workspaces/MSBuild/Contracts/ProjectFileInfo.cs | Defines optional structured-reference collections. |
| src/Workspaces/MSBuild/Contracts/MetadataReferenceItem.cs | Carries interop embedding settings. |
| src/Workspaces/MSBuild/BuildHost/MSBuild/VisualBasic/VisualBasicCommandLineArgumentReader.cs | Stops emitting explicit reference arguments. |
| src/Workspaces/MSBuild/BuildHost/MSBuild/ProjectFile/ProjectInstanceReader.cs | Supplies structured fallback references. |
| src/Workspaces/MSBuild/BuildHost/MSBuild/ProjectFile/Extensions.cs | Reads interop reference metadata. |
| src/Workspaces/MSBuild/BuildHost/MSBuild/ProjectFile/CommandLineArgumentReader.cs | Removes reference argument helpers. |
| src/Workspaces/MSBuild/BuildHost/MSBuild/CSharp/CSharpCommandLineArgumentReader.cs | Stops emitting explicit reference arguments. |
| src/Workspaces/MSBuild/BuildHost/MSBuild/Constants/MetadataNames.cs | Adds interop metadata name. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.Target.cs | Applies references and reconciles document changes. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs | Includes folders in document comparisons. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs | Restores cached references and folders. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LoadedProjectTests.cs | Tests reference application and document updates. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/LanguageServerProjectCacheTests.cs | Tests cached folders and reference properties. |
Review effort: Balanced
davidwengier
approved these changes
Oct 20, 2026
davidwengier
left a comment
Member
There was a problem hiding this comment.
Much nicer than my attempt, though I can see copilot has commented about VB runtime references, which is exactly the rabbit hole I disappeared down, so I trust your authority to ignore that. I guess for the C# extension it doesn't matter anyway.
jasonmalinowski
force-pushed
the
fix-lscache-loading-issues
branch
from
October 20, 2026 22:37
90f8c0b to
d5d0792
Compare
When we were reading from an lscache, we didn't read in metadata references correctly. We did read them in to the ProjectFileInfo's MetadataReferences, but it turns out that collection was only intended for languages that didn't have their references in the command line -- it wasn't actually being used at all in the C#/VB case when we applied the data in LoadedProject. There are two ways we could fix this: we could either turn the loaded data into command line switches, or we could just change the semantics of ProjectFileInfo and just use the metadata references provided as a replacement for the command line string if we have the list. The latter avoids creating any bugs around command line string escaping, and nicely reuses what we already have so we don't have surprises like this again. One small side effect of this is the MetadataReferenceItem now needs to support all Roslyn concepts, so EmbedInteropTypes gets added as a member. Fixes microsoft/vscode-dotnettools#3663
Loading from lscache was not bringing along document folder, so this computes the data. Also ensure we correctly update folders if/when they change. Fixes dotnet/vscode-csharp#9885 Co-authored-by: David Barbet <dabarbet@microsoft.com>
jasonmalinowski
force-pushed
the
fix-lscache-loading-issues
branch
from
October 20, 2026 23:49
d5d0792 to
3f3fa46
Compare
davidwengier
approved these changes
Oct 21, 2026
6 tasks
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.

This fixes two issues:
This replaces #86126 and #86049, but takes an opportunity to create common testing patterns for both of them.
Fixes dotnet/vscode-csharp#9885
Fixes microsoft/vscode-dotnettools#3663
Microsoft Reviewers: Open in CodeFlow