how to fix StreamJsonRpc.ConnectionLostException : The JSON-RPC connection with the remote party was lost before the request could complete. ---> System.OperationCanceledException : The operation was canceled.

Starfall Conquer 25 Reputation points
2023-07-10T23:08:22.1866667+00:00

even upgrade to the latest Version 17.6.4

still does it, can even be idle when it happens, Super annoying.

StreamJsonRpc.ConnectionLostException : The JSON-RPC connection with the remote party was lost before the request could complete. ---> System.OperationCanceledException : The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at async StreamJsonRpc.MessageHandlerBase.WriteAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async StreamJsonRpc.JsonRpc.SendAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async StreamJsonRpc.JsonRpc.InvokeCoreAsync(<Unknown Parameters>)
   --- End of inner exception stack trace ---
   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>)
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,176 questions
{count} votes

9 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 31,086 Reputation points Microsoft Vendor
    2023-07-11T09:52:30.1633333+00:00

    Hello @Starfall Conquer ,

    Welcome to Microsoft Q&A forum.

    I suggest first try cleaning VS cache(rename ComponentModelCache folder(s) in C:\Users\username\AppData\Local\Microsoft\VisualStudio\17.0_xxxxxxxx folder), and then reset VS(run devenv /ResetSettings command in Developer Command Prompt For Visual Studio 2022) => run Visual Studio as administrator.

    Sometimes, updating Windows OS or uninstalling Newtonsoft.Json assembly file(run gacutil -u Newtonsoft.Json in command prompt) works.

    Please feel free to let us know the results.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    5 people found this answer helpful.

  2. FallenDev 30 Reputation points
    2024-01-07T20:36:22.6533333+00:00

    This is still a major issue. I've followed multiple steps stated above and I'm still encountering this. It gets even more annoying where if you ignore it. Sometimes your visual studio just crashes out. Forget saving anything because you don't have time.

    Event logs show the following image. I've uninstalled all .NET Frameworks and reinstalled, I even clean installed Windows 11 Pro and did fresh everything. Still seeing this issue. User's image

    Here's a view of what it looks like in my Visual Studio Enterprise 2022 (64-bit) 17.8.3
    User's image

    Now I added the full photo, so you can see the scroll bar just goes on for days with errors. I'm also curious why Visual Studio is built with .NET Framework 4.8 when we're on .NET 8 now. This could very well be the issue since every month it seems Microsoft is pushing security patches for 4.8.

    Please fix this, it's become exhausting and I really don't feel like switching to Rider.

    5 people found this answer helpful.

  3. Gehan Fernando 10 Reputation points
    2023-09-28T08:52:11.6666667+00:00

    I am using VS 2022 17.7.4 version, and I am getting same error.

    To resolve this issue,

    1. Delete ComponentModelCache
    2. Repair VS 2022
    3. Re-Install VS 2022
    4. Format the machine and re-install VS 2022

    After all same error facing. Microsoft Can you fix this issue asap.

    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 System.Threading.Tasks.ValueTask`1.get_Result()
       at async Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.TryInvokeAsync[TService,TResult](<Unknown Parameters>)
    
    2 people found this answer helpful.

  4. Xavier Rocher 10 Reputation points
    2024-07-15T06:40:32.84+00:00

    Same here. Please help us, because it blocks us to work.

    2 people found this answer helpful.

  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

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.