microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
202 stars 6 forks source link

[BUG] Activating the "Microsoft.VisualStudio.ProjectSystem.Query.Remoting.QueryExecutionService (0.2)" service failed. #840

Open dibarbet opened 5 months ago

dibarbet commented 5 months ago

Describe the Issue

This is copied from a comment on https://github.com/dotnet/vscode-csharp/issues/6777#issuecomment-1879102010, originally posted by @dpoole73

I do see this error when opening code:

Activating the "Microsoft.VisualStudio.CpsProjectIconSourceService (0.1)" service failed.

I also see this in the C# Dev Kit - Test explorer log:

Created Test Controller
Using vstest from dotnet sdk in [/usr/local/share/dotnet/x64/sdk/8.0.100].
Initialized Test Explorer Server [67339]
Test Store Folder: /Users/dpoole/Library/Application Support/Code/User/workspaceStorage/0cb1155ccf7c948a51123cea767d1c2e/ms-dotnettools.csdevkit
Error opening test data: Failed to deserialize Microsoft.VisualStudio.TestWindow.Records.LogEntry value.
Test data was cleared upon opening.
Test data store opened in 0.001 sec.
Initialized project system provider.
Microsoft.ServiceHub.Framework.ServiceActivationFailedException: Activating the "Microsoft.VisualStudio.ProjectSystem.Query.Remoting.QueryExecutionService (0.2)" service failed.
 ---> StreamJsonRpc.RemoteInvocationException: Failed to start host 'dotnet.projectSystem$C94B8CFE-E3FD-4BAF-A941-2866DBB566FE'. Host exited with code '130' (ErrorKind: HostExited)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Microsoft.ServiceHub.Framework.RemoteServiceBroker.GetProxyAsync[T](ServiceRpcDescriptor serviceDescriptor, ServiceActivationOptions options, CancellationToken cancellationToken)
RPC server exception:
StreamJsonRpc.RemoteInvocationException: Failed to start host 'dotnet.projectSystem$C94B8CFE-E3FD-4BAF-A941-2866DBB566FE'. Host exited with code '130' (ErrorKind: HostExited)
      at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
      at Microsoft.ServiceHub.Client.HubClient.RemoteServiceBrokerWrapper.<>c__DisplayClass9_0.<<RequestServiceChannelAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location ---
      at Microsoft.ServiceHub.Client.HubClient.RemoteServiceBrokerWrapper.<>c__DisplayClass9_0.<<RequestServiceChannelAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location ---
      at Microsoft.ServiceHub.Utility.Shared.ServiceHubRetry.ExecuteAsync[TReturnType](Func`1 actionToExecute, TraceSource logger, ServiceHubRetryConfiguration`1 serviceHubRetryConfiguration, CancellationToken cancellationToken)
      at Microsoft.ServiceHub.Utility.Shared.ServiceHubRetry.ExecuteAsync[TReturnType](Func`1 actionToExecute, TraceSource logger, ServiceHubRetryConfiguration`1 serviceHubRetryConfiguration, CancellationToken cancellationToken)
      at Microsoft.ServiceHub.Client.HubClient.RemoteServiceBrokerWrapper.RequestServiceChannelAsync(ServiceMoniker serviceMoniker, ServiceActivationOptions options, CancellationToken cancellationToken)
      at Microsoft.ServiceHub.Client.HubClient.RemoteServiceBrokerWrapper.RequestServiceChannelAsync(ServiceMoniker serviceMoniker, ServiceActivationOptions options, CancellationToken cancellationToken)
      at Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.RequestServiceChannelAsync(ServiceMoniker serviceMoniker, ServiceActivationOptions serviceActivationOptions, CancellationToken cancellationToken)

   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.Framework.RemoteServiceBroker.GetProxyAsync[T](ServiceRpcDescriptor serviceDescriptor, ServiceActivationOptions options, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.ProjectSystem.Query.Remoting.QueryClientExecutionEngine.GetExecutionServiceAsync(CancellationToken cancellationToken)
   at Microsoft.VisualStudio.ProjectSystem.Query.Remoting.QueryClientExecutionEngine.SubscribeAsync[TEntity](AsyncQueryable query, IObserver`1 resultsReceiver, IQueryExecutionRemoteContext remoteContext, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestWindow.VSCode.ProjectSystemProvider.Service.ProjectSystemProviderService.<InitializeAsync>b__8_0()
   at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.CallWithCatchAsync(IInternalLogger log, Func`1 func)

Likely because there is no solution shown in the solution explorer is why the Language server is not working?

Steps To Reproduce

No response

Expected Behavior

No response

Environment Information

i'm seeing very similar issues. I'm running on MacBook with apple silicon using the x64 version of dotnet and setting DOTNET_ROOT

dpoole73 commented 5 months ago

to clarify, the issue happens with or without specifying DOTNET_ROOT it happens on multiple repos as well. Let me know what logs I can share to help figure this out, this is really impacting my productivity

github-actions[bot] commented 2 months ago

This issue has been marked as stale after 14 days of inactivity. @[ @ @], could you please take a look?

Michael-Eng commented 1 month ago

@lifengl Can you check to see if we've fixed this issue (or if it still repros?

AppliedK commented 1 month ago

Same Issue. Activating the "Microsoft.VisualStudio.CpsProjectIconSourceService (0.1)" service failed. I have reinstalled the extensions but the issue is not resolved. VS Code Issue

tophattwaffle commented 1 month ago

I am also having this issue now on a Unity project. Was fine yesterday.

If I uninstall the Unity extension, and then uninstall the c# dev kit extension, then reinstall them both and reload extensions everything works until the next time I close and re-open VSCode.

MyLegend2016 commented 1 month ago

I am also having this issue now on a Unity project. Was fine yesterday.

If I uninstall the Unity extension, and then uninstall the c# dev kit extension, then reinstall them both and reload extensions everything works until the next time I close and re-open VSCode.

Installed v1.4.29 and everything worked fine!

tophattwaffle commented 1 month ago

Installed v1.4.29 and everything worked fine!

Thanks for the heads up. That seems to be working fine for me now.

adam-k-leung commented 1 month ago

I am also having this issue now on a Unity project. Was fine yesterday. If I uninstall the Unity extension, and then uninstall the c# dev kit extension, then reinstall them both and reload extensions everything works until the next time I close and re-open VSCode.

Installed v1.4.29 and everything worked fine!

Can confirm with my Unity project that using v1.5.20 of the C# Dev Kit extension no longer works, but manually downgrading v1.4.29 fixed things.

Michael-Eng commented 1 month ago

@lifengl or @jbevain - could we have broken something in project query?

ericpohl commented 1 month ago

FWIW downgrading C# Dev Kit to v1.4.29 fixed my similar issues. Using "straight" c#, no Unity or web or anything.

lifengl commented 1 month ago

Based on the information posted earlier, it looks like the project system failed to load. Based on the timeline, it is about the time when the project system hosting process was updated to support Aspire projects, but there are also many other things happening about the same time. To understand what was going on, we need help if anyone running into this issue could send us some log files from the extension.

In the session when the extension failed, use vscode command "open extension logs folder", and browse into ms-dotnettools.csdevkit\ServiceHub sub-folder, the first interesting one is named like this:

-hubController--*-1.log

this file should capture some command line information to start the project system process.

The second one is named like -dotnet--*-1.log, which contains the initial logging of the project system hosting process.

The third one is named like -Microsoft.VisualStudio.ProjectSystem.CompositionService--*-1.log, including the project system initialization log.

If the system failed earlier, the later log files might be missing. Or, the earlier log might show things working, and a later failure point might be logged in a later log file.

if anyone can help to provide some content of those files, (or sometime, an exception with call stack in one of that would help us to narrow down what is going on.

also output of dotnet --info might help. Although the original issue was reported from a non-windows platform, the later screen-shot is clearly from a windows machine. The dotnet info command provide some version information of dotnet SDK installed on the machine, sometime, we may not aware of problems when the extension might be broken on a slightly older runtime...

mertdorukkalkan commented 1 month ago

Anyone can help for this situation ? i don't know how to downgrade and i cant see the the version of v1.4.29image

ericpohl commented 1 month ago

@mertdorukkalkan Go to the "C# dev Kit" extension in VSCode. Next to the Uninstall button is a pulldown that will let you install a different version. image

hbflyhbfly commented 4 weeks ago

I change the "C# dev Kit" ver from v1.5.20->1.4.29 fixed it.

image
Doekin commented 4 weeks ago

Maybe the extension requires ASP.NET Runtime . I have .NET SDK installed when encountered this problem, and after installing ASP.NET Runtime, everything works.

The naming convention is too difficult for me to understand.

lifengl commented 3 weeks ago

@Doekin ,

that is what I thought. The difference between 1.5.20 and 1.4.29 is that the newer version requires ASP.NET runtime. Usually, APS.NET would be installed when .NET SDK is installed. Can you run dotnet --info, which may explain what has been installed on the machine?

lifengl commented 3 weeks ago

hmm... I guess one possibility is that the machine has NET 8 Core runtime, but no ASP.NET runtime. Because ASP.NET runtime is installed with SDK, so maybe the machine running into this problem has newer runtime + older SDKs? I wonder maybe certain configuration confused the extension so it picks up a wrong runtime configuration.

Doekin commented 3 weeks ago

On Arch, ASP.NET Runtime is not installed with SDK. 😂

Running command pacman -S dotnet-sdk will install the following paackages we now have To get ASP.NET Runtime, we should run pacman -S aspnet-runtime

max8rr8 commented 3 weeks ago

Same problem on Arch, fixed by installing pasman -S aspnet-runtime

AppliedK commented 3 weeks ago

The issue is resolved by installing the older version of C# Dev Kit. I have now installed v1.5.14 as shown in screenshot below and disabled auto update of extension in VS Code. To disable auto-update in Visual Studio Code (VS Code), you can follow these steps: Open Settings: Press Ctrl+, (Windows/Linux) or Cmd+, (Mac) to open the Settings tab. Alternatively, you can click on File > Preferences > Settings. Search for "update": In the search bar at the top of the Settings tab, type "update". This will filter the settings to show those related to updates. Disable Auto-Update: Look for the setting named "Update: Mode" or similar. Change the value to "none". This setting usually has options like "manual", "default", or "none". Setting it to "none" disables auto-update. Save Changes: Close the Settings tab, and VS Code will automatically save your changes. After following these steps, VS Code should no longer automatically update itself. You'll need to manually check for updates and install them if desired. VS Code Issue

AppliedK commented 3 weeks ago

Anyone can help for this situation ? i don't know how to downgrade and i cant see the the version of v1.4.29image

If you are still having issue. You can install v1.5.14. Look at my comment how to do it.

ericpohl commented 3 weeks ago

@lifengl I finally had a chance to gather logs as you suggested. Starting the 1.5.20 version I get:

Error : You must install or update .NET to run this application.

Error : The following frameworks were found:
6.0.22 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
7.0.11 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]

After installing .NET SDK 8.0 everything works fine now.

lifengl commented 3 weeks ago

thanks @Doekin and @ericpohl,

yeah, it is clear the assumption that the SDK carrying the ASP.Net runtime is incorrect. It is the story to use the Microsoft installation directly. We will find out a solution for this.

In the meaning time, installing ASP.NET runtime would be a straight workaround.

lifengl commented 3 weeks ago

While the team is working on a fix, to work around this issue: 1, install .NET SDK 8.0 to the machine 2, if you are using Arch Linux, make sure install NET 8 Asp.Net runtime along with the NET 8 SDK to the machine.

phadkesharan commented 2 weeks ago

I am also having this issue now on a Unity project. Was fine yesterday.

If I uninstall the Unity extension, and then uninstall the c# dev kit extension, then reinstall them both and reload extensions everything works until the next time I close and re-open VSCode.

Thank you! works fine with v1.4.29

yarpenzigren32850 commented 2 weeks ago

Yes, everything worked for me after installation, too.NET SDK

ruanmed commented 1 week ago

While the team is working on a fix, to work around this issue: 1, install .NET SDK 8.0 to the machine 2, if you are using Arch Linux, make sure install NET 8 Asp.Net runtime along with the NET 8 SDK to the machine.

I was getting the "Microsoft.VisualStudio.CpsProjectIconSourceService (0.1)" service failed. notification whilst trying to open Solution Explorer, and it seems to be solved after installing the aspnet-runtime package that was missing, I thought I only needed the dotnet runtime and SDK packages.

Thanks!

tmeschter commented 1 week ago

Note that the latest prerelease version (currently 1.7.4) has a fix such that the ASP.NET runtime will only be needed if you are launching/debugging Aspire app host projects. This bug will be closed when that fix makes it to a release version.