Skip to content

[NET10] [MacOS] Problems loading project with existing file open in editor #8425

@vsccarl

Description

@vsccarl

Type: Bug

Issue Description

If I open a folder with a C# file already open in the editor, there is a message about problems loading the project. It seems if I have no open files, there is no problem opening the project. After the error messages, the logs show the project does load successfully after.

Steps to Reproduce

Using the latest public .NET 10 Preview 5 build (preview.5.25277.114).

  1. Open a project folder that has an existing C# file open in the editor.

Expected Behavior

Project loads successfully.

Actual Behavior

There are error messages saying there were problems loading the project and the pre-opened file.

Logs

C# log

2025-07-15 16:18:25.726 [info] [Error - 4:18:25 PM] [solution/open] [LanguageServerProjectLoader] Error while loading /Users/scottcarlton/Documents/Testing/blazor_net10/blazor_net10.csproj: Exception thrown: Microsoft.CodeAnalysis.MSBuild.RemoteInvocationException: An exception of type System.InvalidOperationException was thrown: We don't have an MSBuild to use; HasUsableMSBuild should have been called first to check. - file BuildHost.cs line 132
at Microsoft.CodeAnalysis.MSBuild.RpcClient.InvokeCoreAsync(Int32 targetObject, String methodName, List1 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, List1 parameters, CancellationToken cancellationToken) in //src/Workspaces/MSBuild/Core/Rpc/RpcClient.cs:line 135
at Microsoft.CodeAnalysis.MSBuild.RemoteBuildHost.LoadProjectFileAsync(String projectFilePath, String languageName, CancellationToken cancellationToken) in /
/src/Workspaces/MSBuild/Core/Rpc/RemoteBuildHost.cs:line 27
at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.TryLoadProjectInMSBuildHostAsync(BuildHostProcessManager buildHostProcessManager, String projectPath, CancellationToken cancellationToken) in //src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 92
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 202
2025-07-15 16:18:25.737 [info] [Info - 4:18:25 PM] [solution/open] [LanguageServerProjectLoader] Completed (re)load of all projects in 00:00:00.9564933
2025-07-15 16:18:25.827 [info] [Error - 4:18:25 PM] [textDocument/vs_getProjectContexts] [LanguageServerProjectLoader] Error while loading /Users/scottcarlton/Documents/Testing/blazor_net10/Program.cs: Exception thrown: Microsoft.CodeAnalysis.MSBuild.RemoteInvocationException: An exception of type System.InvalidOperationException was thrown: We don't have an MSBuild to use; HasUsableMSBuild should have been called first to check. - file BuildHost.cs line 132
at Microsoft.CodeAnalysis.MSBuild.RpcClient.InvokeCoreAsync(Int32 targetObject, String methodName, List1 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, List1 parameters, CancellationToken cancellationToken) in /
/src/Workspaces/MSBuild/Core/Rpc/RpcClient.cs:line 135
at Microsoft.CodeAnalysis.MSBuild.RemoteBuildHost.LoadProjectAsync(String projectFilePath, String projectContent, String languageName, CancellationToken cancellationToken) in //src/Workspaces/MSBuild/Core/Rpc/RemoteBuildHost.cs:line 37
at Microsoft.CodeAnalysis.LanguageServer.FileBasedPrograms.FileBasedProgramsProjectSystem.TryLoadProjectInMSBuildHostAsync(BuildHostProcessManager buildHostProcessManager, String documentPath, CancellationToken cancellationToken) in /
/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/FileBasedPrograms/FileBasedProgramsProjectSystem.cs:line 162
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 202
2025-07-15 16:18:25.828 [info] [Info - 4:18:25 PM] [textDocument/_vs_getProjectContexts] [LanguageServerProjectLoader] Completed (re)load of all projects in 00:00:02.0366166

C# LSP Trace Logs

Environment information

VSCode version: 1.102.0
C# Extension: 2.86.19
Using OmniSharp: false

Dotnet Information

Host:
Version: 9.0.7
Architecture: x64
Commit: 3c298d9f00
RID: osx-x64

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.NETCore.App 9.0.7 [/Users/scottcarlton/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/9.0.7~x64/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
csharp ms-dotnettools 2.86.19 ms-dotnettools.csharp-2.86.19
vscode-dotnet-runtime ms-dotnettools 2.3.6 ms-dotnettools.vscode-dotnet-runtime-2.3.6

Extension version: 2.86.19
VS Code version: Code 1.102.0 (cb0c47c0cfaad0757385834bd89d410c78a856c0, 2025-07-09T22:10:34.600Z)
OS version: Darwin x64 24.5.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz (8 x 2000)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 4, 13
Memory (System) 16.00GB (0.95GB free)
Process Argv --crash-reporter-id f5e68cba-b1fa-437f-a960-b15cff72fd41
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
binariesv615:30325510
gpt4ocopilotmayc:31348635
962ge761:30959799
h48ei257:31000450
nativeloc1:31344060
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
9064b325:31222308
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixt:31329274
9d2cg352:31346308
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31335814
4f60g487:31327383
nes-diff-11:31337487
992g2967-color:31348502
nes-set-on:31340697
6abeh943:31336334
yijiwantestdri0626-c:31336931
64bie973:31348073
ji9b5146:31342393

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions