Browse Source

Added exception test

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2277 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
128320fba5
  1. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/PropertyInfo.cs
  2. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs
  3. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  4. 9
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs
  5. 3
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs
  6. 19
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Exception.cs
  7. 11
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Exception.xml
  8. 10
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml
  9. 4
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.xml

11
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/PropertyInfo.cs

@ -87,15 +87,18 @@ namespace Debugger @@ -87,15 +87,18 @@ namespace Debugger
public MemberValue GetValue(Value objectInstance, Value[] parameters)
{
if (getMethod == null) throw new CannotGetValueException("Property does not have a get method");
parameters = parameters ?? new Value[0];
Value returnedValue = getMethod.Invoke(objectInstance, parameters ?? new Value[0]);
List<Value> dependencies = new List<Value>();
dependencies.Add(objectInstance);
dependencies.AddRange(parameters);
return new MemberValue(
this,
this.Process,
new IExpirable[] {returnedValue},
new IMutable[] {returnedValue},
delegate { return returnedValue.CorValue; }
dependencies.ToArray(),
dependencies.ToArray(),
delegate { return getMethod.Invoke(objectInstance, parameters).CorValue; }
);
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs

@ -70,8 +70,8 @@ namespace Debugger @@ -70,8 +70,8 @@ namespace Debugger
DateTime startTime = Util.HighPrecisionTimer.Now;
ValueCache newCache = new ValueCache();
newCache.PauseSession = process.PauseSession;
newCache.RawCorValue = corValueGetter();
newCache.PauseSession = process.PauseSession;
newCache.CorValue = DereferenceUnbox(newCache.RawCorValue);
newCache.Type = DebugType.Create(process, newCache.RawCorValue.As<ICorDebugValue2>().ExactType);
cache = newCache;

1
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj

@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\DebuggerTests.cs" />
<Compile Include="Src\DebuggerTestsBase.cs" />
<Compile Include="Src\TestPrograms\Exception.cs" />
<Compile Include="Src\TestPrograms\GenericDictionary.cs" />
<EmbeddedResource Include="Src\TestPrograms\*.cs" />
<EmbeddedResource Include="Src\TestPrograms\*.xml" />

9
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs

@ -389,5 +389,14 @@ namespace Debugger.Tests @@ -389,5 +389,14 @@ namespace Debugger.Tests
process.Continue();
process.WaitForExit();
}
[Test]
public void Exception()
{
StartTest("Exception");
WaitForPause(PausedReason.Exception, null);
process.Continue();
process.WaitForExit();
}
}
}

3
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs

@ -105,6 +105,9 @@ namespace Debugger.Tests @@ -105,6 +105,9 @@ namespace Debugger.Tests
// process.DebuggingResumed += delegate(object sender, ProcessEventArgs e) {
// LogEvent("DebuggingResumed", e.Process.PausedReason.ToString());
// };
process.ExceptionThrown += delegate(object sender, ExceptionEventArgs e) {
LogEvent("ExceptionThrown", e.Exception.Message);
};
process.Expired += delegate(object sender, EventArgs e) {
LogEvent("ProcessExited", null);
};

19
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Exception.cs

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
namespace Debugger.Tests.TestPrograms
{
public class Exception
{
public static void Main()
{
throw new System.Exception("test");
}
}
}

11
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Exception.xml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<DebuggerTests>
<Test name="Exception">
<ProcessStarted />
<ModuleLoaded symbols="False">mscorlib.dll</ModuleLoaded>
<ModuleLoaded symbols="True">Exception.exe</ModuleLoaded>
<DebuggingPaused>Exception</DebuggingPaused>
<ExceptionThrown>test</ExceptionThrown>
<ProcessExited />
</Test>
</DebuggerTests>

10
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml

@ -22,11 +22,6 @@ @@ -22,11 +22,6 @@
<Type>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</Type>
</LocalVariable>
</ObjectDump>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<ObjectDump name="dict members">
<NamedValueCollection>
<Count>16</Count>
@ -445,6 +440,11 @@ @@ -445,6 +440,11 @@
</Items>
</NamedValueCollection>
</ObjectDump>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<ProcessExited />
</Test>
</DebuggerTests>

4
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.xml

@ -22,7 +22,6 @@ @@ -22,7 +22,6 @@
<Type>Debugger.Tests.TestPrograms.ObjectValue</Type>
</LocalVariable>
</ObjectDump>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<ObjectDump name="val members">
<NamedValueCollection>
<Count>3</Count>
@ -107,6 +106,7 @@ @@ -107,6 +106,7 @@
</Items>
</NamedValueCollection>
</ObjectDump>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<DebuggingPaused>Break</DebuggingPaused>
<ObjectDump name="val">
<LocalVariable>
@ -125,7 +125,6 @@ @@ -125,7 +125,6 @@
<Type>Debugger.Tests.TestPrograms.ObjectValue</Type>
</LocalVariable>
</ObjectDump>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<ObjectDump name="val members">
<NamedValueCollection>
<Count>3</Count>
@ -210,6 +209,7 @@ @@ -210,6 +209,7 @@
</Items>
</NamedValueCollection>
</ObjectDump>
<DebuggingPaused>EvalComplete</DebuggingPaused>
<ProcessExited />
</Test>
</DebuggerTests>
Loading…
Cancel
Save