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

Commit a500692

Browse files
authored
Merge pull request #9303 from mono/backport-pr-9302-to-release-8.4
[release-8.4] [Debugger] Catch EvaluatorExceptions in MacObjectValueTreeView.OnCopy()
2 parents 7afe807 + 151f67c commit a500692

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;
@@ -786,10 +788,17 @@ item.Target is ShowMoreValuesObjectValueNode ||
786788
var objVal = item.Target.GetDebuggerObjectValue ();
787789

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

0 commit comments

Comments
 (0)