Browse Source

Added exception handling form

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@65 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
d30595e544
  1. 8
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
  2. 133
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/ExceptionForm.cs
  3. 117
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/ExceptionForm.resx
  4. 9
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  5. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/MTA2STA.cs
  6. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  7. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs

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

@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
<Compile Include="Src\Pads\LoadedModulesPad.cs" />
<Compile Include="Src\Pads\LocalVarPad.cs" />
<Compile Include="Src\Pads\RunningThreadsPad.cs" />
<Compile Include="Src\Service\ExceptionForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Service\WindowsDebugger.cs" />
</ItemGroup>
<ItemGroup>
@ -69,5 +72,10 @@ @@ -69,5 +72,10 @@
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Src\Service\ExceptionForm.resx">
<DependentUpon>ExceptionForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

133
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/ExceptionForm.cs

@ -0,0 +1,133 @@ @@ -0,0 +1,133 @@
// <file>
// <owner name="David Srbecký" email="dsrbecky@post.cz"/>
// </file>
using System;
using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Services
{
public class ExceptionForm : System.Windows.Forms.Form
{
public enum Result {Break, Continue, Ignore};
public Result result = Result.Continue;
public System.Windows.Forms.Label label;
private System.Windows.Forms.Button buttonContinue;
private System.Windows.Forms.Button buttonIgnore;
public System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.Button buttonBreak;
public ExceptionForm()
{
InitializeComponent();
}
#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.buttonBreak = new System.Windows.Forms.Button();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.buttonIgnore = new System.Windows.Forms.Button();
this.buttonContinue = new System.Windows.Forms.Button();
this.label = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// buttonBreak
//
this.buttonBreak.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonBreak.Location = new System.Drawing.Point(176, 160);
this.buttonBreak.Name = "buttonBreak";
this.buttonBreak.Size = new System.Drawing.Size(91, 32);
this.buttonBreak.TabIndex = 0;
this.buttonBreak.Text = "Break";
this.buttonBreak.Click += new System.EventHandler(this.buttonBreak_Click);
//
// pictureBox
//
this.pictureBox.Location = new System.Drawing.Point(14, 16);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(56, 64);
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox.TabIndex = 3;
this.pictureBox.TabStop = false;
//
// buttonIgnore
//
this.buttonIgnore.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonIgnore.Enabled = false;
this.buttonIgnore.Location = new System.Drawing.Point(372, 160);
this.buttonIgnore.Name = "buttonIgnore";
this.buttonIgnore.Size = new System.Drawing.Size(91, 32);
this.buttonIgnore.TabIndex = 2;
this.buttonIgnore.Text = "Ignore";
this.buttonIgnore.Click += new System.EventHandler(this.buttonIgnore_Click);
//
// buttonContinue
//
this.buttonContinue.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonContinue.Location = new System.Drawing.Point(274, 160);
this.buttonContinue.Name = "buttonContinue";
this.buttonContinue.Size = new System.Drawing.Size(91, 32);
this.buttonContinue.TabIndex = 1;
this.buttonContinue.Text = "Continue";
this.buttonContinue.Click += new System.EventHandler(this.buttonContinue_Click);
//
// label
//
this.label.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.label.Location = new System.Drawing.Point(91, 16);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(528, 144);
this.label.TabIndex = 4;
this.label.Text = "label";
//
// ExceptionForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(7, 19);
this.ClientSize = new System.Drawing.Size(638, 203);
this.Controls.Add(this.label);
this.Controls.Add(this.pictureBox);
this.Controls.Add(this.buttonIgnore);
this.Controls.Add(this.buttonContinue);
this.Controls.Add(this.buttonBreak);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExceptionForm";
this.ShowInTaskbar = false;
this.Text = "Exception";
this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void buttonBreak_Click(object sender, System.EventArgs e)
{
result = Result.Break;
Close();
}
private void buttonContinue_Click(object sender, System.EventArgs e)
{
result = Result.Continue;
Close();
}
private void buttonIgnore_Click(object sender, System.EventArgs e)
{
result = Result.Ignore;
Close();
}
}
}

117
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/ExceptionForm.resx

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

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

@ -253,7 +253,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -253,7 +253,7 @@ namespace ICSharpCode.SharpDevelop.Services
//MessageBox.Show("Exception was thrown in debugee:\n" + NDebugger.CurrentThread.CurrentException.ToString());
/*ExceptionForm form = new ExceptionForm();
ExceptionForm form = new ExceptionForm();
form.label.Text = "Exception " +
NDebugger.CurrentThread.CurrentException.Type +
" was thrown in debugee:\n" +
@ -270,7 +270,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -270,7 +270,7 @@ namespace ICSharpCode.SharpDevelop.Services
NDebugger.CurrentThread.ClearCurrentException();
Continue();
return;
}*/
}
}
try {
@ -496,7 +496,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -496,7 +496,7 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
if (IsDebugging && !IsProcessRunning) {
if (IsDebugging && !IsProcessRunning && selectedFunction != null) {
try {
SourcecodeSegment nextStatement = selectedFunction.NextStatement;//cache
@ -507,7 +507,8 @@ namespace ICSharpCode.SharpDevelop.Services @@ -507,7 +507,8 @@ namespace ICSharpCode.SharpDevelop.Services
((IconBarMargin)iconBar).DrawArrow(g, yPos);
}
}
} catch (NextStatementNotAviableException) {}
}
catch (NextStatementNotAviableException) {}
}
}
}

5
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/MTA2STA.cs

@ -109,11 +109,16 @@ namespace DebuggerInterop.Core @@ -109,11 +109,16 @@ namespace DebuggerInterop.Core
}
}
TraceMsg ("Invoke " + functionName + "{");
try {
if (targetObject is Type) {
method.Invoke(null, outputParams);
} else {
method.Invoke(targetObject, outputParams);
}
} catch (System.Exception exception) {
System.Diagnostics.Trace.WriteLine(exception.ToString());
//System.Diagnostics.Debug.Fail("Invoke of " + functionName + " failed.", exception.ToString());
}
TraceMsg ("} \\\\ Invoke");
}
}

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs

@ -321,7 +321,6 @@ namespace DebuggerLibrary @@ -321,7 +321,6 @@ namespace DebuggerLibrary
NDebugger.Instance.ResetEnvironment();
pProcess.Continue(0); //TODO
}
#endregion

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/NDebugger-Threads.cs

@ -81,9 +81,11 @@ namespace DebuggerLibrary @@ -81,9 +81,11 @@ namespace DebuggerLibrary
internal void ClearThreads()
{
foreach (Thread t in threadCollection) {
RemoveThread(t);
foreach (Thread thread in threadCollection) {
thread.ThreadStateChanged -= new ThreadEventHandler(OnThreadStateChanged);
OnThreadExited(thread);
}
threadCollection.Clear();
}
}
}

Loading…
Cancel
Save