public ExceptionCaughtWidget (ExceptionInfo exception)
		{
			this.Build ();

			vboxExceptionInfo.Remove (labelMessage);
			var frame = new InfoFrame (labelMessage);
			frame.Show ();
			vboxExceptionInfo.PackStart (frame, false, true, 0);

			stackStore = new TreeStore (typeof(string), typeof(string), typeof(int), typeof(int));
			treeStack.Model = stackStore;
			var crt = new CellRendererText ();
			crt.Ellipsize = Pango.EllipsizeMode.End;
			crt.WrapWidth = -1;
			treeStack.AppendColumn ("", crt, "markup", 0);
			treeStack.ShowExpanders = false;
			treeStack.RulesHint = true;
			
			valueView.AllowExpanding = true;
			valueView.Frame = DebuggingService.CurrentFrame;
			this.exception = exception;
			
			exception.Changed += HandleExceptionChanged;
			treeStack.SizeAllocated += (object o, SizeAllocatedArgs args) => crt.WrapWidth = args.Allocation.Width;
			
			Fill ();
			treeStack.RowActivated += HandleRowActivated;
		}
Пример #2
0
		public ExceptionCaughtWidget (ExceptionInfo exception)
		{
			this.Build ();

			stackStore = new TreeStore (typeof(string), typeof(string), typeof(int), typeof(int));
			treeStack.Model = stackStore;
			var crt = new CellRendererText ();
			crt.WrapWidth = 200;
			crt.WrapMode = Pango.WrapMode.WordChar;
			treeStack.AppendColumn ("", crt, "markup", 0);
			treeStack.ShowExpanders = false;
			
			valueView.AllowExpanding = true;
			valueView.Frame = DebuggingService.CurrentFrame;
			this.exception = exception;
			
			exception.Changed += HandleExceptionChanged;
			treeStack.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
				if (crt.WrapWidth != args.Allocation.Width)
					crt.WrapWidth = args.Allocation.Width;
			};
			
			Fill ();
			treeStack.RowActivated += HandleRowActivated;
		}
        public override ExceptionInfo GetException(int frameIndex, EvaluationOptions options)
        {

            ObjectValue val = CreateExceptionObject(exceptionRecord);
            ExceptionInfo result = new ExceptionInfo(val);

            return result;
        }
Пример #4
0
        public static void Print(ExceptionInfo ex)
        {
            PrintException(string.Empty, ex);

            var innerEx = ex;
            while ((innerEx = innerEx.InnerException) != null)
                PrintException("--> ", innerEx);
        }
Пример #5
0
		public ExceptionCaughtDialog (ExceptionInfo ex, ExceptionCaughtMessage msg)
		{
			exception = ex;
			message = msg;

			Build ();
			UpdateDisplay ();

			exception.Changed += ExceptionChanged;
		}
Пример #6
0
		public ExceptionCaughtDialog (ExceptionInfo ex, ExceptionCaughtMessage msg)
		{
			this.ApplyTheme ();
			selected = exception = ex;
			message = msg;

			Build ();
			UpdateDisplay ();

			exception.Changed += ExceptionChanged;
		}
Пример #7
0
		public ExceptionCaughtDialog (ExceptionInfo exception)
		{
			this.Build ();
			
			HasSeparator = false;
			
			valueView.AllowExpanding = true;
			valueView.Frame = DebuggingService.CurrentFrame;
			this.exception = exception;
			
			exception.Changed += HandleExceptionChanged;
			
			Fill ();
		}
Пример #8
0
		public ExceptionCaughtDialog (ExceptionInfo ex, ExceptionCaughtMessage msg)
			: base (WindowType.Toplevel)
		{
			this.Child = VBox = new VBox ();
			VBox.Show ();
			this.Name = "wizard_dialog";
			this.ApplyTheme ();
			selected = exception = ex;
			message = msg;

			Build ();
			UpdateDisplay ();

			exception.Changed += ExceptionChanged;
		}
		public ExceptionCaughtDialog (ExceptionInfo exception)
		{
			this.Build ();
			HasSeparator = false;
			
			stackStore = new TreeStore (typeof(string), typeof(string), typeof(int), typeof(int));
			treeStack.Model = stackStore;
			treeStack.AppendColumn ("", new CellRendererText (), "text", 0);
			treeStack.ShowExpanders = false;
			
			valueView.AllowExpanding = true;
			valueView.Frame = DebuggingService.CurrentFrame;
			this.exception = exception;
			
			exception.Changed += HandleExceptionChanged;
			
			Fill ();
		}
Пример #10
0
		void ShowStackTrace (ExceptionInfo exc, bool showExceptionNode)
		{
			TreeIter it = TreeIter.Zero;
			if (showExceptionNode) {
				treeStack.ShowExpanders = true;
				string tn = exc.Type + ": " + exc.Message;
				it = stackStore.AppendValues (tn, null, 0, 0);
			}

			foreach (ExceptionStackFrame frame in exc.StackTrace) {
				if (!it.Equals (TreeIter.Zero))
					stackStore.AppendValues (it, frame.DisplayText, frame.File, frame.Line, frame.Column);
				else
					stackStore.AppendValues (frame.DisplayText, frame.File, frame.Line, frame.Column);
			}
			
			ExceptionInfo inner = exc.InnerException;
			if (inner != null)
				ShowStackTrace (inner, true);
		}
Пример #11
0
		void ShowStackTrace (StringBuilder stack, ExceptionInfo ex)
		{
			ExceptionInfo inner = ex.InnerException;
			
			if (inner != null) {
				stack.AppendFormat ("{0}: {1} ---> ", ex.Type, ex.Message);
				ShowStackTrace (stack, inner);
				stack.AppendLine ("  --- End of inner exception stack trace ---");
			} else {
				stack.AppendFormat ("{0}: {1}\n", ex.Type, ex.Message);
			}
			
			foreach (ExceptionStackFrame frame in ex.StackTrace) {
				stack.Append ("  ");
				stack.AppendLine (frame.DisplayText);
			}
		}
Пример #12
0
		public ExceptionCaughtButton (ExceptionInfo val, ExceptionCaughtMessage dlg, FilePath file, int line)
		{
			this.exception = val;
			this.dlg = dlg;
			OffsetX = 6;
			File = file;
			Line = line;
			closeSelImage = ImageService.GetIcon ("md-popup-close", IconSize.Menu);
			closeSelOverImage = ImageService.GetIcon ("md-popup-close-hover", IconSize.Menu);
		}
Пример #13
0
		public ExceptionCaughtButton (ExceptionInfo val, ExceptionCaughtMessage dlg, FilePath file, int line)
		{
			this.exception = val;
			this.dlg = dlg;
			OffsetX = 6;
			File = file;
			Line = line;
			closeSelImage = Gdk.Pixbuf.LoadFromResource ("MonoDevelop.Close.Selected.png");
			closeSelOverImage = Gdk.Pixbuf.LoadFromResource ("MonoDevelop.Close.Selected.Over.png");
		}
Пример #14
0
		void ShowStackTrace (ExceptionInfo ex, bool showExceptionNode)
		{
			var model = (ListStore) StackTraceTreeView.Model;
			TreeIter iter = TreeIter.Zero;

			if (showExceptionNode) {
				var markup = ex.Type + ": " + ex.Message;
				iter = model.AppendValues (null, markup, false);
				StackTraceTreeView.ShowExpanders = true;
			}

			foreach (var frame in ex.StackTrace) {
				bool isUserCode = IsUserCode (frame);

				if (OnlyShowMyCodeCheckbox.Active && !isUserCode)
					continue;

				var markup = string.Format ("<b>{0}</b>", GLib.Markup.EscapeText (frame.DisplayText));

				if (!string.IsNullOrEmpty (frame.File)) {
					markup += "\n<small>" + GLib.Markup.EscapeText (frame.File);
					if (frame.Line > 0) {
						markup += ":" + frame.Line;
						if (frame.Column > 0)
							markup += "," + frame.Column;
					}
					markup += "</small>";
				}

				if (!iter.Equals (TreeIter.Zero))
					model.AppendValues (iter, frame, markup, isUserCode);
				else
					model.AppendValues (frame, markup, isUserCode);
			}

			var inner = ex.InnerException;
			if (inner != null)
				ShowStackTrace (inner, true);
		}
        public override ExceptionInfo GetException(int frameIndex, EvaluationOptions options)
        {
            ExceptionInfo result = new ExceptionInfo(
                ObjectValue.CreateError(
                    this,
                    new ObjectPath(
                        new string[] { exceptionRecord.ExceptionName }),
                    exceptionRecord.ExceptionName,
                    exceptionRecord.ExceptionInfo,
                    ObjectValueFlags.Error));

            return result;
        }
Пример #16
0
		bool TryGetExceptionInfo (TreePath path, out ExceptionInfo ex)
		{
			var model = (TreeStore) ExceptionValueTreeView.Model;
			TreeIter iter, parent;

			ex = exception;

			if (!model.GetIter (out iter, path))
				return false;

			var value = (ObjectValue) model.GetValue (iter, ObjectValueTreeView.ObjectColumn);
			if (value.Name != "InnerException")
				return false;

			int depth = 0;
			while (model.IterParent (out parent, iter)) {
				iter = parent;
				depth++;
			}

			while (ex != null) {
				if (depth == 0)
					return true;

				ex = ex.InnerException;
				depth--;
			}

			return false;
		}
Пример #17
0
		public ExceptionCaughtMessage (ExceptionInfo val, FilePath file, int line, int col)
		{
			ex = val;
			this.file = file;
			this.line = line;
		}
Пример #18
0
		public ExceptionCaughtDialog (ExceptionInfo val, ExceptionCaughtMessage msg)
		{
			Title = GettextCatalog.GetString ("Exception Caught");
			ex = val;
			widget = new ExceptionCaughtWidget (val);
			this.msg = msg;

			VBox box = new VBox ();
			box.Spacing = 6;
			box.PackStart (widget, true, true, 0);
			HButtonBox buttonBox = new HButtonBox ();
			buttonBox.BorderWidth = 6;

			var copy = new Gtk.Button (GettextCatalog.GetString ("Copy to Clipboard"));
			buttonBox.PackStart (copy, false, false, 0);
			copy.Clicked += HandleCopyClicked;

			var close = new Gtk.Button (GettextCatalog.GetString ("Close"));
			buttonBox.PackStart (close, false, false, 0);
			close.Clicked += (sender, e) => msg.Close ();
			close.Activated += (sender, e) => msg.Close ();

			box.PackStart (buttonBox, false, false, 0);
			VBox.Add (box);

			DefaultWidth = 500;
			DefaultHeight = 350;

			box.ShowAll ();
			ActionArea.Hide ();
		}
Пример #19
0
		void ShowStackTrace (ExceptionInfo exc, bool showExceptionNode)
		{
			TreeIter it = TreeIter.Zero;
			if (showExceptionNode) {
				treeStack.ShowExpanders = true;
				string tn = exc.Type + ": " + exc.Message;
				it = stackStore.AppendValues (tn, null, 0, 0);
			}

			foreach (ExceptionStackFrame frame in exc.StackTrace) {
				string text = GLib.Markup.EscapeText (frame.DisplayText);
				if (!string.IsNullOrEmpty (frame.File)) {
					text += "\n<small>" + GLib.Markup.EscapeText (frame.File);
					if (frame.Line > 0) {
						text += ":" + frame.Line;
						if (frame.Column > 0)
							text += "," + frame.Column;
					}
					text += "</small>";
				}
				if (!it.Equals (TreeIter.Zero))
					stackStore.AppendValues (it, text, frame.File, frame.Line, frame.Column);
				else
					stackStore.AppendValues (text, frame.File, frame.Line, frame.Column);
			}
			
			ExceptionInfo inner = exc.InnerException;
			if (inner != null)
				ShowStackTrace (inner, true);
		}
Пример #20
0
		void ShowStackTrace (ExceptionInfo ex)
		{
			var model = (ListStore) StackTraceTreeView.Model;
			bool external = false;

			model.Clear ();

			foreach (var frame in ex.StackTrace) {
				bool isUserCode = IsUserCode (frame);

				if (OnlyShowMyCodeCheckbox.Active && !isUserCode) {
					if (!external) {
						var str = GettextCatalog.GetString ("<b>[External Code]</b>");
						model.AppendValues (null, str, false);
						external = true;
					}

					continue;
				}

				var markup = string.Format ("<b>{0}</b>", GLib.Markup.EscapeText (frame.DisplayText));

				if (!string.IsNullOrEmpty (frame.File)) {
					markup += "\n<span size='smaller' foreground='#777777'>" + GLib.Markup.EscapeText (frame.File);
					if (frame.Line > 0) {
						markup += ":" + frame.Line;
						if (frame.Column > 0)
							markup += "," + frame.Column;
					}
					markup += "</span>";
				}

				model.AppendValues (frame, markup, isUserCode);
				external = false;
			}

			if (ex.StackIsEvaluating) {
				var str = GettextCatalog.GetString ("Loading...");
				model.AppendValues (null, str, false);
			}
		}
Пример #21
0
		static void PrintException(string prefix, ExceptionInfo ex)
		{
			// HACK: Until we get a `WaitHandle` property on the
			// `Mono.Debugging.Client.ExceptionInfo` type...
			ex.Message.Discard();

			while (ex.Message == "Loading...")
				Thread.Sleep(10);

			Log.Error("{0}{1}: {2}", prefix, ex.Type, ex.Message);
		}
Пример #22
0
		void ShowStackTrace (ExceptionInfo ex)
		{
			var model = (ListStore) StackTraceTreeView.Model;
			bool external = false;

			model.Clear ();

			foreach (var frame in ex.StackTrace) {
				bool isUserCode = IsUserCode (frame);

				if (OnlyShowMyCodeCheckbox.Active && !isUserCode) {
					if (!external) {
						var str = GettextCatalog.GetString ("<b>[External Code]</b>");
						model.AppendValues (null, str, false);
						external = true;
					}

					continue;
				}

				model.AppendValues (frame, null, isUserCode);
				external = false;
			}

			if (ex.StackIsEvaluating) {
				var str = GettextCatalog.GetString ("Loading...");
				model.AppendValues (null, str, false);
			}
		}
Пример #23
0
		static void PrintException(ExceptionInfo ex)
		{
			PrintException(string.Empty, ex);

			var prefix = "> ";
			var inner = ex;

			while ((inner = inner.InnerException) != null)
			{
				PrintException(prefix, inner);

				prefix = "--" + prefix;
			}
		}
Пример #24
0
		void FillInnerExceptionsStore (TreeStore store, ExceptionInfo exception, TreeIter parentIter = default (TreeIter))
		{
			TreeIter iter;
			if (parentIter.Equals (TreeIter.Zero)) {
				iter = store.AppendValues (exception);
				ReverseInnerExceptions [exception] = null;
			} else {
				ReverseInnerExceptions [exception] = (ExceptionInfo)store.GetValue (parentIter, 0);
				iter = store.AppendValues (parentIter, exception);
			}
			var updateInnerExceptions = new System.Action (() => {
				if (!InnerExceptionsStore.IterHasChild (iter)) {
					var innerExceptions = exception.InnerExceptions;
					if (innerExceptions != null && innerExceptions.Count > 0) {
						foreach (var inner in innerExceptions) {
							FillInnerExceptionsStore (store, inner, iter);
						}
					} else {
						var inner = exception.InnerException;
						if (inner != null)
							FillInnerExceptionsStore (store, inner, iter);
					}
				}
			});
			exception.Changed += delegate {
				Application.Invoke (delegate {
					InnerExceptionsStore.EmitRowChanged (InnerExceptionsStore.GetPath (iter), iter);
					updateInnerExceptions ();
					InnerExceptionsTreeView.ExpandRow (InnerExceptionsStore.GetPath (iter), true);
				});
			};
			updateInnerExceptions ();
		}
Пример #25
0
		public ExceptionCaughtMessage (ExceptionInfo val, FilePath file, int line, int col)
		{
			File = file;
			Line = line;
			ex = val;
		}
Пример #26
0
		void UpdateSelectedException (ExceptionInfo ex)
		{
			selected = ex;
			var model = (ListStore)StackTraceTreeView.Model;
			bool external = false;

			model.Clear ();
			var parentException = ex;
			while (parentException != null) {
				foreach (var frame in parentException.StackTrace) {
					bool isUserCode = IsUserCode (frame);

					if (OnlyShowMyCodeCheckbox.Active && !isUserCode) {
						if (!external) {
							var str = "<b>" + GettextCatalog.GetString ("[External Code]") + "</b>";
							model.AppendValues (null, str, false);
							external = true;
						}

						continue;
					}

					model.AppendValues (frame, null, isUserCode);
					external = false;
				}
				if (!ReverseInnerExceptions.TryGetValue (parentException, out parentException))
					parentException = null;
			}
			ExceptionValueTreeView.ClearAll ();
			if (!ex.IsEvaluating && ex.Instance != null) {
				var opts = DebuggingService.GetUserOptions ().EvaluationOptions.Clone ();
				opts.FlattenHierarchy = true;
				ExceptionValueTreeView.AddValues (ex.Instance.GetAllChildren (opts));
			}

			if (ex.StackIsEvaluating) {
				var str = GettextCatalog.GetString ("Loading...");
				model.AppendValues (null, str, false);
			}

			if (InnerExceptionTypeLabel != null) {
				InnerExceptionTypeLabel.Markup = "<b>" + GLib.Markup.EscapeText (ex.Type) + "</b>";
				InnerExceptionMessageLabel.Text = ex.Message;
			}
		}
Пример #27
0
		void ExceptionValueSelectionChanged (object sender, EventArgs e)
		{
			var selectedRows = ExceptionValueTreeView.Selection.GetSelectedRows ();
			ExceptionInfo ex;

			if (selectedRows.Length > 0 && TryGetExceptionInfo (selectedRows[0], out ex)) {
				ShowStackTrace (ex);
				selected = ex;
			} else if (selected != exception) {
				ShowStackTrace (exception);
				selected = exception;
			}
		}
Пример #28
0
 private static void PrintException(string prefix, ExceptionInfo ex)
 {
     Logger.WriteErrorLine("{0}{1}: {2}", prefix, ex.Type, ex.Message);
 }