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 30 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>)
Developer technologies Visual Studio Other
{count} votes

6 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    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. 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

  4. Maciej Milański 0 Reputation points
    2024-01-11T19:57:13.55+00:00

    Hi! I'm not sure in what scenario you're getting this error. In my case it was while trying to train model for text classification. When using vs22 the error occurred, but using mlnet cli tool allow me to train model succesfully. So it was solution for me.

    0 comments No comments

  5. Mark Morrison 0 Reputation points
    2024-01-24T12:28:03.38+00:00

    Regarding this issue I have been experiencing it from last year thinking the issue was with visual studio but since last week I now believe it was an issue with the settings for my CPU in the bios. When I increased the LLC and the vcore and adjusted the frequency for the cores I am no longer experiencing the issue. So persons might need to check if the cores of their CPU are actually stable at specific frequencies, vcore and LLC. My 14900k could not even run 5.8ghz on one of the so called "favored" cores and I had to try and figure out which cores can actually run at the expected 6.0ghz.

    0 comments No comments

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.