From 9ee0b162873b233f149f150af4180c91076db5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Wed, 10 Jan 2007 19:24:48 +0000 Subject: [PATCH] Fixed types for nested generic classes git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2275 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Variables/Types/DebugType.cs | 7 +- .../Project/Src/Variables/Values/Value.cs | 11 +- .../Project/Debugger.Tests.csproj | 1 + .../Project/Src/DebuggerTests.cs | 12 + .../Src/TestPrograms/GenericDictionary.cs | 24 + .../Src/TestPrograms/GenericDictionary.xml | 450 ++++++++++++++++++ 6 files changed, 499 insertions(+), 6 deletions(-) create mode 100644 src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs create mode 100644 src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/DebugType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/DebugType.cs index c25d2248e2..f3011e4485 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/DebugType.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/DebugType.cs @@ -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; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs index 536a813ce4..1e3c7255c7 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs @@ -69,11 +69,12 @@ namespace Debugger if (cache == null || (cache.PauseSession != process.PauseSession && !cache.RawCorValue.Is())) { 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().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().ExactType); + cache = newCache; // AsString representation if (IsNull) cache.AsString = ""; diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj index 34c34f201d..59df2b8224 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj @@ -40,6 +40,7 @@ + diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs index 7453ddf683..b741db123d 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs @@ -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(); + } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs new file mode 100644 index 0000000000..2b217e18ae --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs @@ -0,0 +1,24 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Collections.Generic; + +namespace Debugger.Tests.TestPrograms +{ + public class GenericDictionary + { + public static void Main() + { + Dictionary dict = new Dictionary(); + dict.Add("one",1); + dict.Add("two",2); + dict.Add("three",3); + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml new file mode 100644 index 0000000000..c0d40b9dcd --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml @@ -0,0 +1,450 @@ + + + + + mscorlib.dll + GenericDictionary.exe + Break + + + dict + False + + + + False + {System.Collections.Generic.Dictionary<System.String,System.Int32>} + True + False + False + + False + System.Collections.Generic.Dictionary<System.String,System.Int32> + + + EvalComplete + EvalComplete + EvalComplete + EvalComplete + EvalComplete + + + 16 + + + + + False + True + False + False + buckets + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + buckets + True + 3 + 1 + System.UInt32[] + False + {System.Int32[]} + False + False + False + + False + System.Int32[] + + + + + False + True + False + False + entries + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + entries + True + 3 + 1 + System.UInt32[] + False + {Entry<System.String,System.Int32>[]} + False + False + False + + False + Entry<System.String,System.Int32>[] + + + + + False + True + False + False + count + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + count + False + + + + False + 3 + False + True + True + 3 + False + System.Int32 + + + + + False + True + False + False + version + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + version + False + + + + False + 3 + False + True + True + 3 + False + System.Int32 + + + + + False + True + False + False + freeList + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + freeList + False + + + + False + -1 + False + True + True + -1 + False + System.Int32 + + + + + False + True + False + False + freeCount + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + freeCount + False + + + + False + 0 + False + True + True + 0 + False + System.Int32 + + + + + False + True + False + False + comparer + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + comparer + False + + + + False + {System.Collections.Generic.GenericEqualityComparer<System.String>} + True + False + False + + False + System.Collections.Generic.GenericEqualityComparer<System.String> + + + + + False + True + False + False + keys + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + keys + False + + + + True + <null> + False + False + False + + False + KeyCollection<System.String,System.Int32> + + + + + False + True + False + False + values + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + values + False + + + + True + <null> + False + False + False + + False + ValueCollection<System.String,System.Int32> + + + + + False + True + False + False + _syncRoot + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + _syncRoot + False + + + + True + <null> + False + False + False + + False + System.Object + + + + + False + True + False + False + m_siInfo + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + m_siInfo + False + + + + True + <null> + False + False + False + + False + System.Runtime.Serialization.SerializationInfo + + + + + False + True + False + Comparer + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + Comparer + False + + + + False + {System.TypeLoadException} + True + False + False + + False + System.TypeLoadException + + + + + False + True + False + Count + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + Count + False + + + + False + {System.TypeLoadException} + True + False + False + + False + System.TypeLoadException + + + + + False + True + False + Keys + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + Keys + False + + + + False + {System.TypeLoadException} + True + False + False + + False + System.TypeLoadException + + + + + False + True + False + Values + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + Values + False + + + + False + {System.TypeLoadException} + True + False + False + + False + System.TypeLoadException + + + + + False + True + False + Item + System.Collections.Generic.Dictionary<System.String,System.Int32> + mscorlib.dll + + + Item + False + + + + False + {System.TypeLoadException} + True + False + False + + False + System.TypeLoadException + + + + + + + \ No newline at end of file