"Feature 'XXX' is currently unavailable due to an internal error."

Nathan Sokalski 4,106 Reputation points
2021-12-25T04:05:33.293+00:00

Visual Studio 2022 recently started (for absolutely no reason) displaying the following message(s) at the top of the Visual Studio 2022 window:

Feature 'Diagnostic analyzer runner' is currently unavailable due to an internal error.

Similar messages are displayed for many other features (the list is endless!). This started happening for no reason, I did not change (or even open) the settings or preferences, I did not create (or even edit) any files, I did not install any updates, I barely used my computer. Here is a screenshot of the messages:

160270-screenshot-2021-12-24-225853.png

If I close all the files, it sometimes lets me click the X on the right to get rid of the messages, but then they come back when I reopen the files. What is the problem? I have not tried to repair Visual Studio 2022 (that is, in my opinion, a last resort, since it doesn't always fix the problem). I currently have:

Microsoft Visual Studio Community 2022 (64-bit)
Version 17.0.4

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,193 questions
{count} votes

44 answers

Sort by: Most helpful
  1. R. Cooke 51 Reputation points
    2022-12-08T22:33:49.93+00:00

    Started getting these messages after updating to 17.4.2 earlier this week.
    Tried a repair on Visual Studio, have disabled all extensions. Neither helped.

    268730-vs2022error.png

    Editing to add: I toggled off the highlighted options in Text Editor/C#/Advanced and it seems to have killed this specific error message. Fingers crossed.

    268763-vs2022editoroptionspng.png

    Here's a stack trace:

    StreamJsonRpc.RemoteInvocationException: Cannot enqueue data after PromiseNotToEnqueue.  
       at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__143`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__16`1.MoveNext()  
    RPC server exception:  
    System.InvalidOperationException: Cannot enqueue data after PromiseNotToEnqueue.  
          at Microsoft.CodeAnalysis.Diagnostics.AsyncQueue`1.EnqueueCore(TElement value)  
          at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState)  
          at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType)  
          at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()  
          at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)  
       --- End of stack trace from previous location ---  
          at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)  
       --- End of stack trace from previous location ---  
          at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers()  
          at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean emittingPdb, Boolean emitTestCoverageData, Boolean hasDeclarationErrors, Boolean emitMethodBodies, BindingDiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.<GetDiagnosticsForMethodBodiesInTree>g__compileMethodBodiesAndDocComments|216_0(SyntaxTree filterTree, Nullable`1 filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, Nullable`1 span, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, Nullable`1 filterSpanWithinTree, Boolean includeEarlierStages, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDiagnostics(Nullable`1 span, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GenerateCompilationEvents(AnalysisScope analysisScope, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.ComputeAnalyzerDiagnosticsAsync(AnalysisScope analysisScope, Func`1 getPendingEventsOpt, Int32 newTaskToken, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.ComputeAnalyzerSemanticDiagnosticsAsync(SemanticModel model, AnalysisScope analysisScope, CancellationToken cancellationToken, Boolean forceCompletePartialTrees)  
          at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalysisResultCoreAsync(SemanticModel model, Nullable`1 filterSpan, ImmutableArray`1 analyzers, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzers compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Diagnostics.Extensions.GetAnalysisResultAsync(CompilationWithAnalyzers compilationWithAnalyzers, DocumentAnalysisScope documentAnalysisScope, Project project, DiagnosticAnalyzerInfoCache analyzerInfoCache, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Remote.Diagnostics.DiagnosticComputer.AnalyzeAsync(CompilationWithAnalyzers compilationWithAnalyzers, BidirectionalMap`2 analyzerToIdMap, ImmutableArray`1 analyzers, SkippedHostAnalyzersInfo skippedAnalyzersInfo, Boolean reportSuppressedDiagnostics, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Remote.Diagnostics.DiagnosticComputer.GetDiagnosticsAsync(IEnumerable`1 analyzerIds, Boolean reportSuppressedDiagnostics, Boolean logPerformanceInfo, Boolean getTelemetryInfo, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Remote.RemoteDiagnosticAnalyzerService.<>c__DisplayClass4_0.<<CalculateDiagnosticsAsync>b__0>d.MoveNext()  
       --- End of stack trace from previous location ---  
          at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass7_0`1.<<RunWithSolutionAsync>g__ProcessSolutionAsync|1>d.MoveNext()  
       --- End of stack trace from previous location ---  
          at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunWithSolutionAsync[T](Checksum solutionChecksum, Func`2 implementation, CancellationToken cancellationToken)  
          at Microsoft.CodeAnalysis.Remote.RemoteDiagnosticAnalyzerService.CalculateDiagnosticsAsync(Checksum solutionChecksum, DiagnosticArguments arguments, CancellationToken cancellationToken)  
    

    Setup info:

    Microsoft Visual Studio Enterprise 2022
    Version 17.4.2
    VisualStudio.17.Release/17.4.2+33122.133
    Microsoft .NET Framework
    Version 4.8.04084

    Installed Version: Enterprise

    ASP.NET and Web Tools 17.4.326.54890
    ASP.NET and Web Tools

    Azure App Service Tools v3.0.0 17.4.326.54890
    Azure App Service Tools v3.0.0

    Azure Functions and Web Jobs Tools 17.4.326.54890
    Azure Functions and Web Jobs Tools

    C# Tools 4.4.0-6.22565.8+53091686b435746d62a5df56abfab0e71203d83a
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Common Azure Tools 1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

    Microsoft Azure Tools for Visual Studio 2.9
    Support for Azure Cloud Services projects

    Microsoft JVM Debugger 1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

    NuGet Package Manager 6.4.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

    Razor (ASP.NET Core) 17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
    Provides languages services for ASP.NET Core Razor.

    TypeScript Tools 17.0.10921.2001
    TypeScript Tools for Microsoft Visual Studio

    Visual Basic Tools 4.4.0-6.22565.8+53091686b435746d62a5df56abfab0e71203d83a
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Visual F# Tools 17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
    Microsoft Visual F# Tools

    Visual Studio IntelliCode 2.2
    AI-assisted development for Visual Studio.

    10 people found this answer helpful.

  2. Devon Lehman 16 Reputation points
    2022-06-17T13:54:48.497+00:00

    Getting the same issue in 17.4.2 as of today. https://github.com/dotnet/roslyn/issues/58102

    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://learn.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.

    3 people found this answer helpful.

  3. Nathan Sokalski 4,106 Reputation points
    2021-12-26T16:17:02.91+00:00

    I finally resorted to using Repair, and it (supposedly) fixed it, so I guess I'm good for now, but just as a suggestion/reminder to others, if you can find any other way, use it, because as most of us know, reconfiguring all the settings & configuration of Visual Studio is a major pain, even if you do export & import the settings. I'll consider it fixed (or repaired) for now, but it would still be good to know what happened & how else I could have fixed it for the future.

    1 person found this answer helpful.
    0 comments No comments

  4. Lynn Macfarland 6 Reputation points
    2022-11-22T18:47:58.487+00:00

    VS 2022 just installed (last night/this morning 11/22/2022) and now I am having multiple messages about "unavailable". Didn't have this issue with 2019. Elsewhere Microsoft says it has identified the problem and that the message is a duplicate. Well, Microsoft has not fixed the problem. I doubt if they will. So how do we turn off these messages? If MS actually does fix it (they've known for over a year), when will we be notified?

    1 person found this answer helpful.
    0 comments No comments

  5. Edgar Sanchez 6 Reputation points
    2022-11-28T15:55:21.073+00:00

    264857-image.png

    I'm having the same issue on VS 2022 v17.4.1. Not only that but VS has been chugging a LOT of RAM, like 99% and will sometimes crash my entire computer.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.