diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-01-06 20:41:09 +0300 |
---|---|---|
committer | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-01-08 16:49:46 +0300 |
commit | e4169a889a5b2bca2ff235d77e958d70e7df4894 (patch) | |
tree | 2ca4beb18138b5af67f76bff671f791a14a34d9f | |
parent | d60a8d185a881f99e8b3315878b32c6bc210e3b2 (diff) |
[VsCodeDebugger] Log errors for GetAllLocals
Needed for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1042237/
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs index 9a7c611876..37a2d3a84c 100644 --- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs +++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs @@ -7,6 +7,8 @@ using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; using Mono.Debugging.Backend; using Mono.Debugging.Client; +using MonoDevelop.Core; + using VsFormat = Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages.StackFrameFormat; namespace MonoDevelop.Debugger.VsCodeDebugProtocol @@ -44,17 +46,28 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol public ObjectValue [] GetAllLocals (int frameIndex, EvaluationOptions options) { - List<ObjectValue> results = new List<ObjectValue> (); - var scopeBody = vsCodeDebuggerSession.protocolClient.SendRequestSync (new ScopesRequest (frames [frameIndex].Id)); - foreach (var variablesGroup in scopeBody.Scopes) { + var scopeBody = vsCodeDebuggerSession.protocolClient.SendRequestSync (new ScopesRequest (frames[frameIndex].Id)); + var results = new List<ObjectValue> (); + + foreach (var scope in scopeBody.Scopes) { using (var timer = vsCodeDebuggerSession.EvaluationStats.StartTimer ()) { - var varibles = vsCodeDebuggerSession.protocolClient.SendRequestSync (new VariablesRequest (variablesGroup.VariablesReference)); - foreach (var variable in varibles.Variables) { - results.Add (VsCodeVariableToObjectValue (vsCodeDebuggerSession, variable.Name, variable.EvaluateName, variable.Type, variable.Value, variable.VariablesReference, variablesGroup.VariablesReference, frames [frameIndex].Id)); + VariablesResponse response; + + try { + response = vsCodeDebuggerSession.protocolClient.SendRequestSync (new VariablesRequest (scope.VariablesReference)); + } catch (Exception ex) { + LoggingService.LogError ($"[VsCodeDebugger] Failed to get local variables for the scope: {scope.Name}", ex); + timer.Success = false; + continue; } + + foreach (var variable in response.Variables) + results.Add (VsCodeVariableToObjectValue (vsCodeDebuggerSession, variable.Name, variable.EvaluateName, variable.Type, variable.Value, variable.VariablesReference, scope.VariablesReference, frames[frameIndex].Id)); + timer.Success = true; } } + return results.ToArray (); } |