Browse Source

Fixed types for nested generic classes

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2275 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
9ee0b16287
  1. 7
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/DebugType.cs
  2. 11
      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. 12
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs
  5. 24
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs
  6. 450
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml

7
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/DebugType.cs

@ -288,8 +288,13 @@ namespace Debugger @@ -288,8 +288,13 @@ namespace Debugger
foreach(DebugType arg in GetGenericArguments()) {
argNames.Add(arg.FullName);
}
string className = classProps.Name;
// Remove generic parameter count at the end
string className = classProps.Name.Substring(0, classProps.Name.LastIndexOf('`'));
// '`' might be missing in nested generic classes
int index = className.LastIndexOf('`');
if (index != -1) {
className = className.Substring(0, index);
}
return className + "<" + String.Join(",", argNames.ToArray()) + ">";
} else {
return classProps.Name;

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

@ -69,11 +69,12 @@ namespace Debugger @@ -69,11 +69,12 @@ namespace Debugger
if (cache == null || (cache.PauseSession != process.PauseSession && !cache.RawCorValue.Is<ICorDebugHandleValue>())) {
DateTime startTime = Util.HighPrecisionTimer.Now;
cache = new ValueCache();
cache.PauseSession = process.PauseSession;
cache.RawCorValue = corValueGetter();
cache.CorValue = DereferenceUnbox(RawCorValue);
cache.Type = DebugType.Create(process, RawCorValue.As<ICorDebugValue2>().ExactType);
ValueCache newCache = new ValueCache();
newCache.PauseSession = process.PauseSession;
newCache.RawCorValue = corValueGetter();
newCache.CorValue = DereferenceUnbox(newCache.RawCorValue);
newCache.Type = DebugType.Create(process, newCache.RawCorValue.As<ICorDebugValue2>().ExactType);
cache = newCache;
// AsString representation
if (IsNull) cache.AsString = "<null>";

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\GenericDictionary.cs" />
<EmbeddedResource Include="Src\TestPrograms\*.cs" />
<EmbeddedResource Include="Src\TestPrograms\*.xml" />
</ItemGroup>

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

@ -377,5 +377,17 @@ namespace Debugger.Tests @@ -377,5 +377,17 @@ namespace Debugger.Tests
process.Continue();
process.WaitForExit();
}
[Test]
public void GenericDictionary()
{
StartTest("GenericDictionary");
WaitForPause(PausedReason.Break, null);
ObjectDump("dict", process.SelectedFunction.LocalVariables["dict"]);
ObjectDump("dict members", process.SelectedFunction.LocalVariables["dict"].GetMembers(null, BindingFlags.All));
process.Continue();
process.WaitForExit();
}
}
}

24
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
// <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;
using System.Collections.Generic;
namespace Debugger.Tests.TestPrograms
{
public class GenericDictionary
{
public static void Main()
{
Dictionary<string, int> dict = new Dictionary<string, int>();
dict.Add("one",1);
dict.Add("two",2);
dict.Add("three",3);
System.Diagnostics.Debugger.Break();
}
}
}

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

@ -0,0 +1,450 @@ @@ -0,0 +1,450 @@
<?xml version="1.0" encoding="utf-8"?>
<DebuggerTests>
<Test name="GenericDictionary">
<ProcessStarted />
<ModuleLoaded symbols="False">mscorlib.dll</ModuleLoaded>
<ModuleLoaded symbols="True">GenericDictionary.exe</ModuleLoaded>
<DebuggingPaused>Break</DebuggingPaused>
<ObjectDump name="dict">
<LocalVariable>
<Name>dict</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<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>
<Items>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>buckets</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>buckets</Name>
<IsArray>True</IsArray>
<ArrayLenght>3</ArrayLenght>
<ArrayRank>1</ArrayRank>
<ArrayDimensions>System.UInt32[]</ArrayDimensions>
<IsNull>False</IsNull>
<AsString>{System.Int32[]}</AsString>
<IsObject>False</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.Int32[]</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>entries</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>entries</Name>
<IsArray>True</IsArray>
<ArrayLenght>3</ArrayLenght>
<ArrayRank>1</ArrayRank>
<ArrayDimensions>System.UInt32[]</ArrayDimensions>
<IsNull>False</IsNull>
<AsString>{Entry&lt;System.String,System.Int32&gt;[]}</AsString>
<IsObject>False</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>Entry&lt;System.String,System.Int32&gt;[]</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>count</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>count</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>3</AsString>
<IsObject>False</IsObject>
<IsPrimitive>True</IsPrimitive>
<IsInteger>True</IsInteger>
<PrimitiveValue>3</PrimitiveValue>
<HasExpired>False</HasExpired>
<Type>System.Int32</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>version</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>version</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>3</AsString>
<IsObject>False</IsObject>
<IsPrimitive>True</IsPrimitive>
<IsInteger>True</IsInteger>
<PrimitiveValue>3</PrimitiveValue>
<HasExpired>False</HasExpired>
<Type>System.Int32</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>freeList</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>freeList</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>-1</AsString>
<IsObject>False</IsObject>
<IsPrimitive>True</IsPrimitive>
<IsInteger>True</IsInteger>
<PrimitiveValue>-1</PrimitiveValue>
<HasExpired>False</HasExpired>
<Type>System.Int32</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>freeCount</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>freeCount</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>0</AsString>
<IsObject>False</IsObject>
<IsPrimitive>True</IsPrimitive>
<IsInteger>True</IsInteger>
<PrimitiveValue>0</PrimitiveValue>
<HasExpired>False</HasExpired>
<Type>System.Int32</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>comparer</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>comparer</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.Collections.Generic.GenericEqualityComparer&lt;System.String&gt;}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.Collections.Generic.GenericEqualityComparer&lt;System.String&gt;</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>keys</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>keys</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString>
<IsObject>False</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>KeyCollection&lt;System.String,System.Int32&gt;</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>values</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>values</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString>
<IsObject>False</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>ValueCollection&lt;System.String,System.Int32&gt;</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>_syncRoot</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>_syncRoot</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString>
<IsObject>False</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.Object</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<FieldInfo>
<IsLiteral>False</IsLiteral>
<IsPrivate>True</IsPrivate>
<IsPublic>False</IsPublic>
<IsStatic>False</IsStatic>
<Name>m_siInfo</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</FieldInfo>
</MemberInfo>
<Name>m_siInfo</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString>
<IsObject>False</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.Runtime.Serialization.SerializationInfo</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<PropertyInfo>
<IsPrivate>False</IsPrivate>
<IsPublic>True</IsPublic>
<IsStatic>False</IsStatic>
<Name>Comparer</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</PropertyInfo>
</MemberInfo>
<Name>Comparer</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<PropertyInfo>
<IsPrivate>False</IsPrivate>
<IsPublic>True</IsPublic>
<IsStatic>False</IsStatic>
<Name>Count</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</PropertyInfo>
</MemberInfo>
<Name>Count</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<PropertyInfo>
<IsPrivate>False</IsPrivate>
<IsPublic>True</IsPublic>
<IsStatic>False</IsStatic>
<Name>Keys</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</PropertyInfo>
</MemberInfo>
<Name>Keys</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<PropertyInfo>
<IsPrivate>False</IsPrivate>
<IsPublic>True</IsPublic>
<IsStatic>False</IsStatic>
<Name>Values</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</PropertyInfo>
</MemberInfo>
<Name>Values</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type>
</MemberValue>
<MemberValue>
<MemberInfo>
<PropertyInfo>
<IsPrivate>False</IsPrivate>
<IsPublic>True</IsPublic>
<IsStatic>False</IsStatic>
<Name>Item</Name>
<DeclaringType>System.Collections.Generic.Dictionary&lt;System.String,System.Int32&gt;</DeclaringType>
<Module>mscorlib.dll</Module>
</PropertyInfo>
</MemberInfo>
<Name>Item</Name>
<IsArray>False</IsArray>
<ArrayLenght exception="Value is not an array" />
<ArrayRank exception="Value is not an array" />
<ArrayDimensions exception="Value is not an array" />
<IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString>
<IsObject>True</IsObject>
<IsPrimitive>False</IsPrimitive>
<IsInteger>False</IsInteger>
<PrimitiveValue exception="Value is not a primitive type" />
<HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type>
</MemberValue>
</Items>
</NamedValueCollection>
</ObjectDump>
<ProcessExited />
</Test>
</DebuggerTests>
Loading…
Cancel
Save