Skip to content

[Bug] Error loading project for misc file in VSCode #78591

@dibarbet

Description

@dibarbet

Opened a project, then opened a random .cs (not part the project). Got a warning saying the project failed to load for the file on disk with the following stack:

2025-05-14 18:33:25.254 [info] [Error - 6:33:25 PM] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Error while loading c:\Users\dabarbet\Downloads\file_on_disk.cs: Exception thrown: Microsoft.CodeAnalysis.MSBuild.RemoteInvocationException: An exception of type System.ArgumentException was thrown: All build submissions in a build must use project instances originating from the same project collection.
   at Microsoft.CodeAnalysis.MSBuild.RpcClient.InvokeCoreAsync(Int32 targetObject, String methodName, List`1 parameters, Type expectedReturnType, CancellationToken cancellationToken) in /_/src/Workspaces/MSBuild/Core/Rpc/RpcClient.cs:line 186
   at Microsoft.CodeAnalysis.MSBuild.RpcClient.InvokeAsync[T](Int32 targetObject, String methodName, List`1 parameters, CancellationToken cancellationToken) in /_/src/Workspaces/MSBuild/Core/Rpc/RpcClient.cs:line 135
   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectLoader.ReloadProjectAsync(ProjectToLoad projectToLoad, ToastErrorReporter toastErrorReporter, BuildHostProcessManager buildHostProcessManager, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectLoader.cs:line 226

I haven't managed to reproduce it extremely often, but I opened it while the original project was loading (so potentially multiple misc file loads happening at once)?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions