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
227 stars 11 forks source link

[BUG] [macOS] The debugging buttons failed to work #1457

Open fanyang-mono opened 4 weeks ago

fanyang-mono commented 4 weeks ago

Describe the Issue

I started debugging my C# project using Command Palette, using the Debug: Select and Start Debugging command. Then chose C# and my project.

During the debugger setup process, it hit this exception:

Exception: StreamJsonRpc.ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete.
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync(JsonRpcRequest request, Type expectedResultType, CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at VsDbg.BrokeredServices.Services.HotReloadServiceSender.<StartSession>b__4_0()
   at VsDbg.BrokeredServices.Services.BaseServiceSender.<>c__DisplayClass8_0.<<ExecuteEventInQueue>b__0>d.MoveNext()
Exception: 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 System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at StreamJsonRpc.MessageHandlerBase.WriteAsync(JsonRpcMessage content, CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.SendAsync(JsonRpcMessage message, CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync(JsonRpcRequest request, Type expectedResultType, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync(JsonRpcRequest request, Type expectedResultType, CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at VsDbg.BrokeredServices.Services.HotReloadServiceSender.<>c__DisplayClass8_0.<<OnProcessStarted>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at VsDbg.BrokeredServices.Services.BaseServiceSender.<>c__DisplayClass8_0.<<ExecuteEventInQueue>b__0>d.MoveNext()

But the project was able to start successfully. Then I added a breakpoint and enter the input to my project. Afterwards, it was able to stop at the breakpoint that I set successfully. However, when clicking on continue, step over, step into or step out, I hit the follow error. While restart and stop button works.

Your changes cannot be applied due to an unexpected error: ConnectionLostException. The 'next' operation was cancelled.

Steps To Reproduce

  1. Set a breakpoint in your .net8 project
  2. Kick off debugging using the Debug: Select and Start Debugging command of a c# project
  3. After it stop at the breakpoint, click step over

Expected Behavior

All the debugging buttons should work.

Environment Information

WardenGnaw commented 4 weeks ago

@fanyang-mono

Your changes cannot be applied due to an unexpected error

This error message comes from Hot Reload. Do you have the hot reload settings enabled? You can find these options in File -> Preferences -> Settings and searching for Hot Reload image

fanyang-mono commented 4 weeks ago

Yes, I do have hot reload enabled.

WardenGnaw commented 4 weeks ago

Do you see the error if you disable it?

fanyang-mono commented 4 weeks ago

Yes. Exactly the same.

WardenGnaw commented 4 weeks ago

Can you enable csharp.debug.logging.diagnosticsLog.protocolMessages in the settings and share the output from the Debug Console?

fanyang-mono commented 4 weeks ago

Emailed you the log.

fanyang-mono commented 3 weeks ago

I just upgraded my VS Code to 1.93.0 and the issue is gone.