diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2019-03-25 16:11:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 16:11:50 +0300 |
commit | 1a70c31b3603b227a6f3ec11144ddfc1b8ab7901 (patch) | |
tree | 211dc3dee65b328301571afc27e24efc4a52fc4d | |
parent | 1ca061374111c121c5aa95cc59eda4eb72773df2 (diff) | |
parent | 76eb6718b0db1a0b611b63002c0e0cdbad9b6f38 (diff) |
Merge pull request #406 from xamarin/fix-visualizer-crash-8.0
Fix crash when showing debugger visualizer
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/PreviewVisualizerWindow.cs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/PreviewVisualizerWindow.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/PreviewVisualizerWindow.cs index 34b7907cd6..4db71a90f1 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/PreviewVisualizerWindow.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.PreviewVisualizers/PreviewVisualizerWindow.cs @@ -35,6 +35,7 @@ using MonoDevelop.Debugger.PreviewVisualizers; using MonoDevelop.Ide; using MonoDevelop.Ide.Fonts; using MonoDevelop.Ide.Commands; +using Mono.Debugging.Evaluation; namespace MonoDevelop.Debugger { @@ -100,12 +101,21 @@ namespace MonoDevelop.Debugger Control widget = null; try { widget = previewVisualizer?.GetVisualizerWidget (val); + } catch (EvaluatorException ex) { + widget = CreateErrorPreview (ex.Message); } catch (Exception e) { - DebuggingService.DebuggerSession.LogWriter (true, "Exception during preview widget creation: " + e.Message); + LoggingService.LogInternalError ("Exception during preview widget creation", e); } if (widget == null) { - genericPreview = new GenericPreviewVisualizer (); - widget = genericPreview.GetVisualizerWidget (val); + try { + genericPreview = new GenericPreviewVisualizer (); + widget = genericPreview.GetVisualizerWidget (val); + } catch (EvaluatorException ex) { + widget = CreateErrorPreview (ex.Message); + } catch (Exception ex) { + widget = CreateErrorPreview (GettextCatalog.GetString ("There was an error retrieving the value")); + LoggingService.LogInternalError (ex); + } } var alignment = new Alignment (0, 0, 1, 1); alignment.SetPadding (3, 5, 5, 5); @@ -115,6 +125,15 @@ namespace MonoDevelop.Debugger ContentBox.Add (mainBox); } + Gtk.Widget CreateErrorPreview (string message) + { + var box = new HBox (false, 3); + box.PackStart (new ImageView (MonoDevelop.Ide.Gui.Stock.Error, IconSize.Menu), false, false, 0); + box.PackStart (new Gtk.Label (message), false, false, 0); + box.ShowAll (); + return box; + } + [CommandUpdateHandler (EditCommands.Copy)] protected void OnCopyUpdate (CommandInfo cmd) { |