dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.92k stars 4.02k forks source link

Feature xxx is currently unavailable due to an internal error. StreamJsonRpc.RemoteInvocationException: Cannot find the old value #58102

Closed 3x0dv5 closed 2 years ago

3x0dv5 commented 2 years ago

This is following up from the comments I posted on https://github.com/dotnet/roslyn/issues/54204, the although the UI is reporting the same problem it is not the same underlying problem

Version Used: Visual Studio 2022 - Version 17.1.0 Preview 1.1 with Resharper 2021.3 EAP10 dotnet core 6

Steps to Reproduce: hi, just got the error. It happened when on a Blazor App I was editing a razor file. When in the razor file I tried to use a variable that hadn't been declared yet.

image

The stack traces: For Documents highlights

StreamJsonRpc.RemoteInvocationException: Cannot find the old value
Parameter name: oldValue
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__18`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
System.ArgumentException: Cannot find the old value
Parameter name: oldValue
      at System.Collections.Immutable.ImmutableArray`1.Replace(T oldValue, T newValue, IEqualityComparer`1 equalityComparer)
      at Microsoft.CodeAnalysis.GeneratorDriver.ReplaceAdditionalText(AdditionalText oldText, AdditionalText newText)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildDeclarationCompilationFromInProgressAsync>d__35.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildFinalStateFromInProgressStateAsync>d__34.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildCompilationInfoAsync>d__30.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetOrBuildCompilationInfoAsync>d__29.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetCompilationSlowAsync>d__27.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Document.<GetSemanticModelAsync>d__23.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.<GetRequiredSemanticModelAsync>d__6.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.DocumentHighlighting.AbstractDocumentHighlightsService.<GetDocumentHighlightsInCurrentProcessAsync>d__1.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.DocumentHighlighting.AbstractDocumentHighlightsService.<GetDocumentHighlightsAsync>d__0.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteDocumentHighlightsService.<>c__DisplayClass2_0.<<GetDocumentHighlightsAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__13`1.MoveNext()

for semantic classification

StreamJsonRpc.RemoteInvocationException: Cannot find the old value
Parameter name: oldValue
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__18`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
System.ArgumentException: Cannot find the old value
Parameter name: oldValue
      at System.Collections.Immutable.ImmutableArray`1.Replace(T oldValue, T newValue, IEqualityComparer`1 equalityComparer)
      at Microsoft.CodeAnalysis.GeneratorDriver.ReplaceAdditionalText(AdditionalText oldText, AdditionalText newText)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildDeclarationCompilationFromInProgressAsync>d__35.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildFinalStateFromInProgressStateAsync>d__34.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildCompilationInfoAsync>d__30.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetOrBuildCompilationInfoAsync>d__29.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetCompilationSlowAsync>d__27.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Document.<GetSemanticModelAsync>d__23.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.<GetRequiredSemanticModelAsync>d__6.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Classification.AbstractSyntaxClassificationService.<AddSemanticClassificationsAsync>d__5.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSemanticClassificationsInCurrentProcessAsync>d__3.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationService.<>c__DisplayClass2_0.<<GetSemanticClassificationsAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Threading.Tasks.ValueTask`1.get_Result()
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__13`1.MoveNext()

for Navigation bar

StreamJsonRpc.RemoteInvocationException: Cannot find the old value
Parameter name: oldValue
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__18`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
System.ArgumentException: Cannot find the old value
Parameter name: oldValue
      at System.Collections.Immutable.ImmutableArray`1.Replace(T oldValue, T newValue, IEqualityComparer`1 equalityComparer)
      at Microsoft.CodeAnalysis.GeneratorDriver.ReplaceAdditionalText(AdditionalText oldText, AdditionalText newText)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildDeclarationCompilationFromInProgressAsync>d__35.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildFinalStateFromInProgressStateAsync>d__34.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildCompilationInfoAsync>d__30.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetOrBuildCompilationInfoAsync>d__29.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetCompilationSlowAsync>d__27.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Document.<GetSemanticModelAsync>d__23.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.<GetRequiredSemanticModelAsync>d__6.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.CSharp.NavigationBar.CSharpNavigationBarItemService.<GetTypesInFileAsync>d__5.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.CSharp.NavigationBar.CSharpNavigationBarItemService.<GetItemsInCurrentProcessAsync>d__3.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.NavigationBar.AbstractNavigationBarItemService.<GetItemsAsync>d__1.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteNavigationBarItemService.<>c__DisplayClass2_0.<<GetItemsAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Threading.Tasks.ValueTask`1.get_Result()
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__13`1.MoveNext()

for semantic classification cache

StreamJsonRpc.RemoteInvocationException: Cannot find the old value
Parameter name: oldValue
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
System.ArgumentException: Cannot find the old value
Parameter name: oldValue
      at System.Collections.Immutable.ImmutableArray`1.Replace(T oldValue, T newValue, IEqualityComparer`1 equalityComparer)
      at Microsoft.CodeAnalysis.GeneratorDriver.ReplaceAdditionalText(AdditionalText oldText, AdditionalText newText)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildDeclarationCompilationFromInProgressAsync>d__35.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildFinalStateFromInProgressStateAsync>d__34.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<BuildCompilationInfoAsync>d__30.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetOrBuildCompilationInfoAsync>d__29.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.<GetCompilationSlowAsync>d__27.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Document.<GetSemanticModelAsync>d__23.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.<GetRequiredSemanticModelAsync>d__6.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Classification.AbstractSyntaxClassificationService.<AddSemanticClassificationsAsync>d__5.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSemanticClassificationsInCurrentProcessAsync>d__3.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Classification.AbstractClassificationService.<AddSemanticClassificationsAsync>d__2.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationCacheService.<CacheSemanticClassificationsAsync>d__7.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationCacheService.<CacheSemanticClassificationsAsync>d__7.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationCacheService.<>c__DisplayClass6_0.<<CacheSemanticClassificationsAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__15.MoveNext()

now the only way to stop getting these errors is to restart visual studio, otherwise any action - click, typing - I do will bring the 4 errors back.

jasonmalinowski commented 2 years ago

This was fully fixed by https://github.com/dotnet/roslyn/pull/58024, we had a hack in place to squelch this issue for 17.0.1 (which was merged in https://github.com/dotnet/roslyn/pull/57680).

@3x0dv5 unfortunately neither of those are present in 17.1 Previews; the Preview 2 build will contain the hack so that should be good. Preview 2 isn't out yet but should be in the next week or so. In the mean time, I'd suggest running 17.0.1.

3x0dv5 commented 2 years ago

Good stuff, once it's up I'll install Preview 2. For now I keep working around it. Thanks!

jasonmalinowski commented 2 years ago

And Preview 2's date was delayed a bit so "next week" won't be the case. :smile:

3x0dv5 commented 2 years ago

it is what it is... better a delay than a bad release. New year, new Visual Studio version!

jasonmalinowski commented 2 years ago

@3x0dv5 Preview 2 is now out, if that helps!

3x0dv5 commented 2 years ago

@jasonmalinowski Initial tests, so far so good. Thank you!

donchak commented 2 years ago

Hi! I have a similar problem. 0fe4084d-a0d2-4577-b38e-4b56c376e98d

Version Used: Visual Studio 2022 - Version 17.1.0 Preview 4 with CodeRush fo VS 2022 21.2.6 dotnet core 6

The stack trace is common for all services:

StreamJsonRpc.ConnectionLostException : The JSON-RPC connection with the remote party was lost before the request could complete.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async StreamJsonRpc.JsonRpc.InvokeCoreAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.TryInvokeAsync[TService](<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

I also found crash dumps of ServiceHub.RoslynCodeAnalysisService.exe.

Unhandled exception at 0x00007FF92C7A0E89 in ServiceHub.RoslynCodeAnalysisService.exe.28116.dmp: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x000000E24C805F68).

ServiceHub.RoslynCodeAnalysisService.exe.28116.zip

Here is a project to reproduce: GrpcService1.zip

Is it the same issue or separate?

DrLeh commented 2 years ago

Getting same issue today in version 17.4.2 :(

DrLeh commented 2 years ago

Same issue in version 17.4.2 popped up for me this week when I went to set up a new machine, so it seems the issue isn't fully resolved.

image

StreamJsonRpc.ConnectionLostException : The JSON-RPC connection with the remote party was lost before the request could complete.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async StreamJsonRpc.JsonRpc.InvokeCoreAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.TryInvokeAsync[TService,TResult](<Unknown Parameters>)

I'm not doing anything in particular when it happens. I open a solution i've worked in for years on a previous machine, VS2022 on that machine has no issues. After coding for a bit this will happen and my intellisense drops. After restart it will work again for a few minutes. Other, smaller solutions seem to work for longer but will also get the issue sometimes.

Fully fresh install of VS 2022, no extensions added. I even ran the InstallCleanup.exe step from here https://docs.microsoft.com/en-us/visualstudio/install/uninstall-visual-studio?view=vs-2022 to do a completely fresh install.

Since this is related to Microsoft.CodeAnalysis, could it somehow be the .net installation? Should I try to reinstall .NET 6 on my machine?

My only other idea is that there could be some policy on my machine that is causing the JSON-RPC call to not be allowed? I'm not sure what it's connecting to though so not sure what to look for there.

DrLeh commented 2 years ago

Running .\devenv.exe /safemode i get an exception at startup:

image

Log file shows this stack trace:

6/17/2022 10:17:15 AM
LimitedFunctionality
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.ProjectSystem.VS.MissingSetupComponentRegistrationService.AddMissingSdkRuntimeComponentIds(IVsSetupCompositionService setupCompositionService, Dictionary`2 vsComponentIdsToRegister)
   at Microsoft.VisualStudio.ProjectSystem.VS.MissingSetupComponentRegistrationService.ComputeVsComponentIdsToRegister(IVsSetupCompositionService setupCompositionService)
   at Microsoft.VisualStudio.ProjectSystem.VS.MissingSetupComponentRegistrationService.<DisplayMissingComponentsPromptAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__Action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.ProjectSystem.VS.MissingSetupComponentRegistrationService.AddMissingSdkRuntimeComponentIds(IVsSetupCompositionService setupCompositionService, Dictionary`2 vsComponentIdsToRegister)
   at Microsoft.VisualStudio.ProjectSystem.VS.MissingSetupComponentRegistrationService.ComputeVsComponentIdsToRegister(IVsSetupCompositionService setupCompositionService)
   at Microsoft.VisualStudio.ProjectSystem.VS.MissingSetupComponentRegistrationService.<DisplayMissingComponentsPromptAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__Action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )<---

===================

This makes it seem like something is broken with my VS2022 installation. As mentioned before, I've already tried a repair and a full reinstall. Unless anyone has any other ideas, my only idea i can think of at this point is to have IT reimage my entire machine and do a new install.

Found a similar issue here: https://developercommunity.visualstudio.com/t/issue-opening-visual-studio-2022-ide-after-new-ins/1631790

The solution to this was to remove newtonsoft.json from the GAC. My GAC does not have newtonsoft.json in it so this doesn't help.

DrLeh commented 2 years ago

ActivityLog.xml is showing me other errors.

Many like this with different dlls:

Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.VisualStudio.ConnectedServices.Package2, Version=17.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
          C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\WEB TOOLS\ProjectSystem\Microsoft.WebTools.ProjectSystem.Components.dll

This path exists on my disk, not sure why it can't find it.

Then some others, this one stands out to me:

Microsoft.ServiceHub.Framework.ServiceActivationFailedException: Activating the "Microsoft.VisualStudio.TraceHubCommand (1.0)" service failed.
 ---> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)
   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)
   at Microsoft.VisualStudio.Services.VSGlobalBrokeredServiceContainer.PackageServiceRegistration.<LoadProfferingPackageAsync>d__4.MoveNext() 
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.<LoadProfferingPackageAsync>d__25.MoveNext() 
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.<TryGetProfferingSourceAsync>d__24.MoveNext() 
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.<GetProxyAsync>d__19`1.MoveNext() 
   --- End of inner exception stack trace ---

Then at the bottom i'm seeing this one:

SetSite failed for package [Microsoft.VisualStudio.PlatformUI.NavigateToPackage]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.Language.NavigateTo.Interfaces, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 
tmat commented 2 years ago

@DrLeh Thanks for reporting the issue. Would you mind filing VS Feedback from Visual Studio (menu Help > Send Feedback > Report a Problem)? It will collect logs that will help us to diagnose the problem.

DrLeh commented 2 years ago

@tmat when I select Report a Problem, I got the error to connect my account. After refreshing my credentials, Report a Problem does nothing. Sounds like my VS is super borked.

Did a VS repair, still nothing on the report a problem button.

lrslima commented 2 years ago

I'm facing the same error

Visual Studio Community 2022 17.2.4

I've tried VS repair but didn't work

image

lrslima commented 2 years ago

I've noticed that when I run my VS as administrator I get this error but when I run as "normal" mode this error doesn't occur

DrLeh commented 2 years ago

I have also been encountering it more on a solution that has net472 web apps in it. My other solutions in net 6 didn't cause a failure after a full work day

CyrusNajmabadi commented 2 years ago

@lrslima @DrLeh what are the stack traces you are seein gthere? These notifications can happen for numerous reasons, so without additional information, we won't know what the case is here. Note: we do automatically report these as well through VS's telemetry system. So if you are not opted out of that, we will have the data on these.

lrslima commented 2 years ago

@CyrusNajmabadi When I try to report as administrator my VS crashes.

from ActivityLog.xml file

  <entry>
    <record>325</record>
    <time>2022/06/20 21:13:32.710</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [Global Hub Client Package]Source: &apos;Microsoft.ServiceHub.Client&apos; Description: Microsoft.ServiceHub.Controller.exe exited normally before accepting connection. Increasing the controller cooldown timeout may be necessary.&#x000D;&#x000A;</description>
    <guid>{11AD60FC-6D87-4674-8F88-9ABE79176CBE}</guid>
    <hr>80131509</hr>
    <errorinfo></errorinfo>
  </entry>
CyrusNajmabadi commented 2 years ago

@lrslima I mean this part: image

lrslima commented 2 years ago

@CyrusNajmabadi

Microsoft.ServiceHub.Framework.ServiceActivationFailedException : Activating the "Microsoft.VisualStudio.LanguageServices.ProcessTelemetry64" service failed. ---> System.InvalidOperationException : An operation is not legal in the current state. (Exception from HRESULT: 0x80131509) at Microsoft.VisualStudio.Shell.Interop.IVsTaskBody.DoWork(IVsTask pTask,UInt32 dwCount,IVsTask[] pParentTasks,Object& pResult) at Microsoft.VisualStudio.Services.VsTask.<>cDisplayClass86_0.b0(Task1[] _) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.Tasks.Task.Execute() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) at async Microsoft.VisualStudio.Services.VSGlobalBrokeredServiceContainer.PackageServiceRegistration.LoadProfferingPackageAsync() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.LoadProfferingPackageAsync() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.TryGetProfferingSourceAsync() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.GetProxyAsync[T]() --- End of inner exception stack trace --- at async Microsoft.VisualStudio.Utilities.ServiceBroker.GlobalBrokeredServiceContainer.View.GetProxyAsync[T]() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.ValueTask`1.get_Result() at async Microsoft.ServiceHub.Framework.ServiceBrokerClient.<>cDisplayClass21_0`1.b0[T]() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.VisualStudio.Threading.AsyncLazy1.<>c__DisplayClass13_0.<GetValueAsync>b__0[T](<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.ServiceHub.Framework.ServiceBrokerClient.GetProxyAsync[T](<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.ValueTask1.get_Result() at async Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection1.RentServiceAsync[TService](<Unknown Parameters>) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.ValueTask1.get_Result() at async Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.TryInvokeAsync[TService]()

CyrusNajmabadi commented 2 years ago

@lrslima could you please open a new issue? your stck trace is untirely unrelated to the stack of hte fixed crash references in this issue. Thanks!

lrslima commented 2 years ago

Just to register

https://developercommunity2.visualstudio.com/t/VS-2022-1724-error-when-execute-as-adm/10075895

DrLeh commented 2 years ago

@CyrusNajmabadi here's the stack traces i get

image

StreamJsonRpc.ConnectionLostException : The JSON-RPC connection with the remote party was lost before the request could complete.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async StreamJsonRpc.JsonRpc.InvokeCoreAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.TryInvokeAsync[TService](<Unknown Parameters>)
CyrusNajmabadi commented 2 years ago

@DrLeh please open a different issue. Add your can see, your callstacks are different from this issue and from @lrslima