Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 151f67c

Browse files
jstedfastmonojenkins
authored andcommitted
[Debugger] Catch EvaluatorExceptions in MacObjectValueTreeView.OnCopy()
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1016073/
1 parent f344787 commit 151f67c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacObjectValueTreeView.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
using Foundation;
3333
using CoreGraphics;
3434

35+
using Mono.Debugging.Evaluation;
36+
3537
using MonoDevelop.Core;
3638
using MonoDevelop.Ide.Commands;
3739
using MonoDevelop.Components.Commands;
@@ -784,10 +786,17 @@ item.Target is ShowMoreValuesObjectValueNode ||
784786
var objVal = item.Target.GetDebuggerObjectValue ();
785787

786788
if (objVal != null) {
787-
// HACK: we need a better abstraction of the stack frame, better yet would be to not really need it in the view
788-
var opt = DebuggerService.Frame.GetStackFrame ().DebuggerSession.Options.EvaluationOptions.Clone ();
789-
opt.EllipsizeStrings = false;
790-
value = '"' + Mono.Debugging.Evaluation.ExpressionEvaluator.EscapeString ((string)objVal.GetRawValue (opt)) + '"';
789+
try {
790+
// HACK: we need a better abstraction of the stack frame, better yet would be to not really need it in the view
791+
var opt = DebuggerService.Frame.GetStackFrame ().DebuggerSession.Options.EvaluationOptions.Clone ();
792+
opt.EllipsizeStrings = false;
793+
794+
var rawValue = (string) objVal.GetRawValue (opt);
795+
796+
value = '"' + Mono.Debugging.Evaluation.ExpressionEvaluator.EscapeString (rawValue) + '"';
797+
} catch (EvaluatorException) {
798+
// fall back to using the DisplayValue that we would have used anyway...
799+
}
791800
}
792801
}
793802

0 commit comments

Comments
 (0)