diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2020-01-06 20:41:09 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2020-01-09 22:05:02 +0300 |
commit | 801ed925b66acd166b5cfb49e7021e0ffc4a5f30 (patch) | |
tree | 6ae95f88b4da2c98f9ab472f657e18572e17615b /main | |
parent | 82b6b113a8e9c2299ca7434bbccd3b9ef97434dd (diff) |
[VsCodeDebugger] Log errors for GetAllLocals
Needed for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1042237/
Diffstat (limited to 'main')
-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 (); } |