Browse Source

Created new ExceptionForm based on suggestions from forums/9446

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4043 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
f08507a12c
  1. 10
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
  2. 5
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptions.cs
  3. 155
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebugeeExceptionForm.Designer.cs
  4. 163
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebugeeExceptionForm.cs
  5. 110
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggeeExceptionForm.Designer.cs
  6. 151
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggeeExceptionForm.cs
  7. 0
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggeeExceptionForm.resx
  8. 6
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggerEventForm.cs
  9. 28
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

10
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj

@ -94,11 +94,11 @@ @@ -94,11 +94,11 @@
<Compile Include="Src\Service\AttachToProcessForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Service\DebugeeExceptionForm.cs">
<Compile Include="Src\Service\DebuggeeExceptionForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Service\DebugeeExceptionForm.Designer.cs">
<DependentUpon>DebugeeExceptionForm.cs</DependentUpon>
<Compile Include="Src\Service\DebuggeeExceptionForm.Designer.cs">
<DependentUpon>DebuggeeExceptionForm.cs</DependentUpon>
</Compile>
<Compile Include="Src\Service\DebuggerEventForm.cs">
<SubType>Form</SubType>
@ -106,8 +106,8 @@ @@ -106,8 +106,8 @@
<Compile Include="Src\Service\DebuggerEventForm.Designer.cs">
<DependentUpon>DebuggerEventForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Src\Service\DebugeeExceptionForm.resx">
<DependentUpon>DebugeeExceptionForm.cs</DependentUpon>
<EmbeddedResource Include="Src\Service\DebuggeeExceptionForm.resx">
<DependentUpon>DebuggeeExceptionForm.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Src\Service\EditBreakpointScriptForm.cs">
<SubType>Form</SubType>

5
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptions.cs

@ -28,12 +28,9 @@ namespace ICSharpCode.SharpDevelop.Services @@ -28,12 +28,9 @@ namespace ICSharpCode.SharpDevelop.Services
// Properties for the DebuggerExceptionForm
public FormWindowState DebuggerEventWindowState = FormWindowState.Normal;
public Size DebuggerEventWindowSize = new Size(646, 235);
// Properties for the DebuggeeExceptionForm
public FormWindowState DebuggeeExceptionWindowState = FormWindowState.Normal;
public Size DebuggeeExceptionWindowSize = new Size(646,431);
public int DebugeeExceptionSplitterDistance = 163;
public bool ShowExceptionDetails;
public double DebuggeeExceptionWindowOpacity = 0.75;
}
}

155
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebugeeExceptionForm.Designer.cs generated

@ -1,155 +0,0 @@ @@ -1,155 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#region License
//
// Copyright (c) 2007, ic#code
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the ic#code nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#endregion
using System;
using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Services
{
partial class DebugeeExceptionForm : DebuggerEventForm
{
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
this.exceptionDetails = new Aga.Controls.Tree.TreeViewAdv();
this.linkExceptionDetail = new System.Windows.Forms.LinkLabel();
this.splitContainer = new System.Windows.Forms.SplitContainer();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// buttonBreak
//
this.buttonBreak.Location = new System.Drawing.Point(176, 349);
//
// buttonContinue
//
this.buttonContinue.Location = new System.Drawing.Point(274, 349);
//
// buttonTerminate
//
this.buttonTerminate.Location = new System.Drawing.Point(372, 349);
//
// textBox
//
this.textBox.Size = new System.Drawing.Size(542, 139);
//
// exceptionDetails
//
this.exceptionDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.exceptionDetails.AutoRowHeight = true;
this.exceptionDetails.BackColor = System.Drawing.SystemColors.Window;
this.exceptionDetails.DefaultToolTipProvider = null;
this.exceptionDetails.DragDropMarkColor = System.Drawing.Color.Black;
this.exceptionDetails.LineColor = System.Drawing.SystemColors.ControlDark;
this.exceptionDetails.LoadOnDemand = true;
this.exceptionDetails.Location = new System.Drawing.Point(3, 4);
this.exceptionDetails.Model = null;
this.exceptionDetails.Name = "exceptionDetails";
this.exceptionDetails.SelectedNode = null;
this.exceptionDetails.Size = new System.Drawing.Size(539, 153);
this.exceptionDetails.TabIndex = 4;
this.exceptionDetails.UseColumns = true;
//
// linkExceptionDetail
//
this.linkExceptionDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.linkExceptionDetail.Location = new System.Drawing.Point(3, 142);
this.linkExceptionDetail.Name = "linkExceptionDetail";
this.linkExceptionDetail.Size = new System.Drawing.Size(543, 23);
this.linkExceptionDetail.TabIndex = 5;
this.linkExceptionDetail.TabStop = true;
this.linkExceptionDetail.Text = "${res:MainWindow.Windows.Debug.ExceptionForm.ShowExceptionDetails}";
this.linkExceptionDetail.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkExceptionDetailLinkClicked);
//
// splitContainer
//
this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer.Location = new System.Drawing.Point(76, 16);
this.splitContainer.Name = "splitContainer";
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.Controls.Add(this.linkExceptionDetail);
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.exceptionDetails);
this.splitContainer.Size = new System.Drawing.Size(550, 327);
this.splitContainer.SplitterDistance = 163;
this.splitContainer.TabIndex = 6;
//
// DebugeeExceptionForm
//
this.ClientSize = new System.Drawing.Size(638, 399);
this.Controls.Add(this.splitContainer);
this.Name = "DebugeeExceptionForm";
this.Resize += new System.EventHandler(this.debugeeExceptionFormResize);
this.Controls.SetChildIndex(this.splitContainer, 0);
this.Controls.SetChildIndex(this.textBox, 0);
this.Controls.SetChildIndex(this.buttonBreak, 0);
this.Controls.SetChildIndex(this.buttonContinue, 0);
this.Controls.SetChildIndex(this.buttonTerminate, 0);
this.Controls.SetChildIndex(this.pictureBox, 0);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
private Aga.Controls.Tree.TreeViewAdv exceptionDetails;
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.LinkLabel linkExceptionDetail;
#endregion
}
}

163
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebugeeExceptionForm.cs

@ -1,163 +0,0 @@ @@ -1,163 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#region License
//
// Copyright (c) 2007, ic#code
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the ic#code nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Aga.Controls.Tree;
using Aga.Controls.Tree.NodeControls;
using Debugger;
using Debugger.AddIn.TreeModel;
using Debugger.Expressions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Services
{
internal sealed partial class DebugeeExceptionForm
{
private DebugeeExceptionForm()
{
InitializeComponent();
// Windows form designer cannot place a component declared in a base class in a container component
// declared in a child class. Hence we do it manually.
Controls.Remove(textBox);
textBox.Location = new Point(0, 4);
splitContainer.Panel1.Controls.Add(textBox);
// To make the exceptionDetails size properly, it must be rendered full size in the designer.
// To get the text right we set the panel to the opposite of what we want and then fire linkExceptionDetail.Click().
splitContainer.Panel2Collapsed = DebuggingOptions.Instance.ShowExceptionDetails;
DebuggingOptions.Instance.ShowExceptionDetails = ! DebuggingOptions.Instance.ShowExceptionDetails;
linkExceptionDetailLinkClicked(linkExceptionDetail, new EventArgs());
WindowState = DebuggingOptions.Instance.DebuggeeExceptionWindowState;
Size = DebuggingOptions.Instance.DebuggeeExceptionWindowSize;
splitContainer.SplitterDistance = DebuggingOptions.Instance.DebugeeExceptionSplitterDistance;
// Set this here so it doesnt fire on startup replacing the saved value with a default.
this.splitContainer.SplitterMoved += new SplitterEventHandler(this.splitContainerMoved);
InitializeExceptionDetails();
}
/// <summary>
/// Setup the columns for the exceptionDetails.
/// </summary>
private void InitializeExceptionDetails() {
NodeIcon iconControl = new ItemIcon();
NodeTextBox nameControl = new ItemName();
NodeTextBox textControl = new ItemText();
NodeTextBox typeControl = new ItemType();
TreeColumn nameColumn = new TreeColumn();
TreeColumn valColumn = new TreeColumn();
TreeColumn typeColumn = new TreeColumn();
exceptionDetails.Columns.Add(nameColumn);
exceptionDetails.Columns.Add(valColumn);
exceptionDetails.Columns.Add(typeColumn);
exceptionDetails.UseColumns = true;
exceptionDetails.SelectionMode = TreeSelectionMode.Single;
exceptionDetails.LoadOnDemand = true;
iconControl.ParentColumn = nameColumn;
exceptionDetails.NodeControls.Add(iconControl);
nameControl.ParentColumn = nameColumn;
exceptionDetails.NodeControls.Add(nameControl);
textControl.ParentColumn = valColumn;
exceptionDetails.NodeControls.Add(textControl);
typeControl.ParentColumn = typeColumn;
exceptionDetails.NodeControls.Add(typeControl);
nameColumn.Header = ResourceService.GetString("Global.Name");
nameColumn.Width = 165;
valColumn.Header = ResourceService.GetString("Dialog.HighlightingEditor.Properties.Value");
valColumn.Width = 200;
typeColumn.Header = ResourceService.GetString("ResourceEditor.ResourceEdit.TypeColumn");
typeColumn.Width = 170;
}
public static Result Show(Process process, string title, string message, Bitmap icon, bool canContinue)
{
using (DebugeeExceptionForm form = new DebugeeExceptionForm()) {
form.Text = title;
form.pictureBox.Image = icon;
form.textBox.Text = message;
IList<AbstractNode> exceptionNodes = new List<AbstractNode>();
exceptionNodes.Add(ValueNode.Create(new CurrentExceptionExpression()));
form.exceptionDetails.BeginUpdate();
TreeViewVarNode.SetContentRecursive(process, form.exceptionDetails, exceptionNodes);
form.exceptionDetails.EndUpdate();
form.exceptionDetails.Refresh();
form.buttonContinue.Enabled = canContinue;
form.ShowDialog(WorkbenchSingleton.MainForm);
return form.result;
}
}
void debugeeExceptionFormResize(object sender, EventArgs e)
{
DebuggingOptions.Instance.DebuggeeExceptionWindowSize = Size;
DebuggingOptions.Instance.DebuggeeExceptionWindowState = WindowState;
}
void linkExceptionDetailLinkClicked(object sender, EventArgs e)
{
splitContainer.Panel2Collapsed = ! splitContainer.Panel2Collapsed;
DebuggingOptions.Instance.ShowExceptionDetails = ! splitContainer.Panel2Collapsed;
linkExceptionDetail.Text = splitContainer.Panel2Collapsed
? StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.ShowExceptionDetails}")
: StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.HideExceptionDetails}");
}
void splitContainerMoved(object sender, EventArgs e)
{
DebuggingOptions.Instance.DebugeeExceptionSplitterDistance = splitContainer.SplitterDistance;
}
}
}

110
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggeeExceptionForm.Designer.cs generated

@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#region License
//
// Copyright (c) 2007, ic#code
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the ic#code nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#endregion
using System;
using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Services
{
partial class DebuggeeExceptionForm : Form
{
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
this.pictureBox = new System.Windows.Forms.PictureBox();
this.lblExceptionText = new System.Windows.Forms.Label();
this.exceptionView = new System.Windows.Forms.RichTextBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// pictureBox
//
this.pictureBox.Location = new System.Drawing.Point(12, 12);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(48, 52);
this.pictureBox.TabIndex = 0;
this.pictureBox.TabStop = false;
//
// lblExceptionText
//
this.lblExceptionText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblExceptionText.Location = new System.Drawing.Point(66, 12);
this.lblExceptionText.Name = "lblExceptionText";
this.lblExceptionText.Size = new System.Drawing.Size(560, 52);
this.lblExceptionText.TabIndex = 1;
this.lblExceptionText.Text = "Exception Message Text";
//
// exceptionView
//
this.exceptionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.exceptionView.BackColor = System.Drawing.SystemColors.Control;
this.exceptionView.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.exceptionView.Location = new System.Drawing.Point(12, 70);
this.exceptionView.Name = "exceptionView";
this.exceptionView.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
this.exceptionView.Size = new System.Drawing.Size(614, 317);
this.exceptionView.TabIndex = 2;
this.exceptionView.Text = "";
//
// DebuggeeExceptionForm
//
this.ClientSize = new System.Drawing.Size(638, 399);
this.Controls.Add(this.exceptionView);
this.Controls.Add(this.lblExceptionText);
this.Controls.Add(this.pictureBox);
this.Name = "DebuggeeExceptionForm";
this.Resize += new System.EventHandler(this.debugeeExceptionFormResize);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
}
private System.Windows.Forms.RichTextBox exceptionView;
private System.Windows.Forms.Label lblExceptionText;
private System.Windows.Forms.PictureBox pictureBox;
#endregion
}
}

151
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggeeExceptionForm.cs

@ -0,0 +1,151 @@ @@ -0,0 +1,151 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#region License
//
// Copyright (c) 2007, ic#code
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the ic#code nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Aga.Controls.Tree;
using Aga.Controls.Tree.NodeControls;
using Debugger;
using Debugger.AddIn.TreeModel;
using Debugger.Expressions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Services
{
internal sealed partial class DebuggeeExceptionForm
{
Process process;
bool active;
DebuggeeExceptionForm(Process process)
{
InitializeComponent();
this.process = process;
this.process.Exited += ProcessHandler;
this.process.Resumed += ProcessHandler;
this.FormClosed += FormClosedHandler;
this.Activated += delegate { this.active = true; this.Opacity = 1; };
this.Deactivate += delegate { this.active = false; this.Opacity = DebuggingOptions.Instance.DebuggeeExceptionWindowOpacity; };
this.WindowState = DebuggingOptions.Instance.DebuggeeExceptionWindowState;
FormLocationHelper.Apply(this, "DebuggeeExceptionForm", true);
this.Opacity = DebuggingOptions.Instance.DebuggeeExceptionWindowOpacity;
this.MouseLeave += FormLeave;
this.MouseEnter += FormEnter;
this.lblExceptionText.MouseEnter += FormEnter;
this.pictureBox.MouseEnter += FormEnter;
this.exceptionView.MouseEnter += FormEnter;
this.MinimizeBox = this.MaximizeBox = this.ShowIcon = false;
this.exceptionView.DoubleClick += ExceptionViewDoubleClick;
}
void ProcessHandler(object sender, EventArgs e)
{
this.Close();
}
void FormEnter(object sender, EventArgs e)
{
this.Opacity = 1;
}
void FormLeave(object sender, EventArgs e)
{
if (!this.active)
this.Opacity = DebuggingOptions.Instance.DebuggeeExceptionWindowOpacity;
}
void FormClosedHandler(object sender, EventArgs e)
{
this.process.Exited -= ProcessHandler;
this.process.Resumed -= ProcessHandler;
}
public static void Show(Process process, string title, string message, string stacktrace, Bitmap icon)
{
DebuggeeExceptionForm form = new DebuggeeExceptionForm(process);
form.Text = title;
form.pictureBox.Image = icon;
form.lblExceptionText.Text = message;
form.exceptionView.Text = stacktrace;
form.Show(WorkbenchSingleton.MainForm);
}
void ExceptionViewDoubleClick(object sender, EventArgs e)
{
string fullText = exceptionView.Text;
// Any text?
if (fullText.Length > 0) {
//int line = textEditorControl.ActiveTextAreaControl.Caret.Line;
//string textLine = TextUtilities.GetLineAsString(textEditorControl.Document, line);
Point clickPos = exceptionView.PointToClient(Control.MousePosition);
int index = exceptionView.GetCharIndexFromPosition(clickPos);
int start = index;
// find start of current line
while (--start > 0 && fullText[start - 1] != '\n');
// find end of current line
while (++index < fullText.Length && fullText[index] != '\n');
string textLine = fullText.Substring(start, index - start);
FileLineReference lineReference = OutputTextLineParser.GetFileLineReference(textLine);
if (lineReference != null) {
// Open matching file.
FileService.JumpToFilePosition(lineReference.FileName, lineReference.Line, lineReference.Column);
}
}
}
void debugeeExceptionFormResize(object sender, EventArgs e)
{
DebuggingOptions.Instance.DebuggeeExceptionWindowState = WindowState;
}
}
}

0
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebugeeExceptionForm.resx → src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggeeExceptionForm.resx

6
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DebuggerEventForm.cs

@ -57,10 +57,9 @@ namespace ICSharpCode.SharpDevelop.Services @@ -57,10 +57,9 @@ namespace ICSharpCode.SharpDevelop.Services
buttonBreak.Text = StringParser.Parse(buttonBreak.Text);
buttonContinue.Text = StringParser.Parse(buttonContinue.Text);
buttonTerminate.Text = StringParser.Parse(buttonTerminate.Text);
WindowState = DebuggingOptions.Instance.DebuggerEventWindowState;
Size = DebuggingOptions.Instance.DebuggerEventWindowSize;
FormLocationHelper.Apply(this, "DebuggerEventForm", true);
}
/// <summary>
@ -103,7 +102,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -103,7 +102,6 @@ namespace ICSharpCode.SharpDevelop.Services
void debuggerEventFormResize(object sender, EventArgs e)
{
DebuggingOptions.Instance.DebuggerEventWindowSize = Size;
DebuggingOptions.Instance.DebuggerEventWindowState = WindowState;
}
}

28
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -660,47 +660,35 @@ namespace ICSharpCode.SharpDevelop.Services @@ -660,47 +660,35 @@ namespace ICSharpCode.SharpDevelop.Services
JumpToCurrentLine();
StringBuilder msg = new StringBuilder();
StringBuilder stacktraceBuilder = new StringBuilder();
// Need to intercept now so that we can evaluate properties
if (e.Process.SelectedThread.InterceptCurrentException()) {
msg.AppendLine(e.Exception.ToString());
stacktraceBuilder.AppendLine(e.Exception.ToString());
string stackTrace;
try {
stackTrace = e.Exception.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}"));
} catch (GetValueException) {
stackTrace = e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}"));
}
msg.Append(stackTrace);
stacktraceBuilder.Append(stackTrace);
} else {
// For example, happens on stack overflow
msg.AppendLine(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}"));
msg.AppendLine(e.Exception.ToString());
msg.Append(e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}")));
stacktraceBuilder.AppendLine(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}"));
stacktraceBuilder.AppendLine(e.Exception.ToString());
stacktraceBuilder.Append(e.Process.SelectedThread.GetStackTrace(StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}"), StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}")));
}
string title = e.IsUnhandled ? StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Title.Unhandled}") : StringParser.Parse("${res:MainWindow.Windows.Debug.ExceptionForm.Title.Handled}");
string message = msg.ToString();
string message = string.Format("An exception of type {0} was thrown:\n{1}", e.Exception.Type, e.Exception.Message);
Bitmap icon = WinFormsResourceService.GetBitmap(e.IsUnhandled ? "Icons.32x32.Error" : "Icons.32x32.Warning");
bool canContinue = !e.IsUnhandled;
//DebuggerEventForm.Result result = DebuggerEventForm.Show(title, message, icon, canContinue);
DebuggerEventForm.Result result = DebugeeExceptionForm.Show(debuggedProcess, title, message, icon, canContinue);
DebuggeeExceptionForm.Show(debuggedProcess, title, message, stacktraceBuilder.ToString(), icon);
// If the process was killed while the exception form is still being displayed
if (e.Process.HasExited) return;
switch (result) {
case DebuggerEventForm.Result.Break:
break;
case DebuggerEventForm.Result.Continue:
e.Process.AsyncContinue();
break;
case DebuggerEventForm.Result.Terminate:
e.Process.Terminate();
break;
}
}
public void JumpToCurrentLine()

Loading…
Cancel
Save