Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.InvalidOperationException: We don't have an MSBuild to use #63

Open
Dreamoochy opened this issue Nov 15, 2023 · 4 comments
Open

Comments

@Dreamoochy
Copy link

I've updated to .NET 8, VSCodium 1.84.2 and free-vscode-csharp v2.10.28.
Now at the start I get the following notification for each project in a workspace:

[Error - 9:41:41 AM] [LanguageServerProjectSystem] Exception thrown while loading %file_path_of_csproj% StreamJsonRpc.RemoteInvocationException: We don't have an MSBuild to use; HasUsableMSBuildAsync should have been called first to check. - line 133
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, BuildHostProcessManager buildHostProcessManager, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 206
RPC server exception:
System.InvalidOperationException: We don't have an MSBuild to use; HasUsableMSBuildAsync should have been called first to check. - line 133
      at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 154
      at Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.BuildHost.EnsureMSBuildLoaded(String projectFilePath) in /_/src/Workspaces/Core/MSBuild.BuildHost/BuildHost.cs:line 133
      at Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.BuildHost.IsProjectFileSupportedAsync(String projectFilePath, CancellationToken cancellationToken) in /_/src/Workspaces/Core/MSBuild.BuildHost/BuildHost.cs:line 163
      at InvokeStub_BuildHost.IsProjectFileSupportedAsync(Object, Object, IntPtr*)
      at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
@ixkipe
Copy link

ixkipe commented Dec 2, 2023

I've updated to .NET 8, VSCodium 1.84.2 and free-vscode-csharp v2.10.28. Now at the start I get the following notification for each project in a workspace:

[Error - 9:41:41 AM] [LanguageServerProjectSystem] Exception thrown while loading %file_path_of_csproj% StreamJsonRpc.RemoteInvocationException: We don't have an MSBuild to use; HasUsableMSBuildAsync should have been called first to check. - line 133
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, BuildHostProcessManager buildHostProcessManager, CancellationToken cancellationToken) in /_/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 206
RPC server exception:
System.InvalidOperationException: We don't have an MSBuild to use; HasUsableMSBuildAsync should have been called first to check. - line 133
      at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 154
      at Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.BuildHost.EnsureMSBuildLoaded(String projectFilePath) in /_/src/Workspaces/Core/MSBuild.BuildHost/BuildHost.cs:line 133
      at Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.BuildHost.IsProjectFileSupportedAsync(String projectFilePath, CancellationToken cancellationToken) in /_/src/Workspaces/Core/MSBuild.BuildHost/BuildHost.cs:line 163
      at InvokeStub_BuildHost.IsProjectFileSupportedAsync(Object, Object, IntPtr*)
      at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

Same for me, is .NET 8 support coming?

@Said1996
Copy link

Said1996 commented Dec 3, 2023

in the meantime any workaround is appreciated.

@muhammadsammy
Copy link
Owner

Can't reproduce. What OS are you using? Try updating the extension to v2.12.19

@herbertsschaefe
Copy link

Apparently fixed!

The problem was consistent in all Unity3D projects after updating .Net Code to 8.0.
OS: Arch Linux
free-vscode-csharp: v2.10.28
VSCodium: v1.84.2

After updating to v2.12.19 the behavior does not occur anymore in any project.
Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants