diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs
index 128ed722aa..0c3e15d465 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs
@@ -206,9 +206,7 @@ namespace Debugger
throw new GetValueException("Invalid parameter count");
}
if (thisValue != null) {
- if (!(thisValue.IsObject)) {
- throw new GetValueException("Can not evaluate on a value which is not an object");
- }
+ // if (!(thisValue.IsObject)) // eg Can evaluate on array
if (!method.DeclaringType.IsInstanceOfType(thisValue)) {
throw new GetValueException(
"Can not evaluate because the object is not of proper type. " +
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
index 815b0cd799..fbf62675a2 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
@@ -217,6 +217,14 @@ namespace Debugger.MetaData
///
public DebugType BaseType {
get {
+ // corType.Base does not work for arrays
+ if (this.IsArray) {
+ return DebugType.GetType(this.Process, "System.Array");
+ }
+ // corType.Base does not work for primitive types
+ if (this.IsPrimitive) {
+ return DebugType.GetType(this.Process, "System.Object");
+ }
ICorDebugType baseType = corType.Base;
if (baseType != null) {
return Create(process, baseType);
diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
index 004d7f1838..3cf2aea35e 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Object.cs
@@ -43,9 +43,7 @@ namespace Debugger
if (objectInstance.IsNull) {
throw new GetValueException("Null reference");
}
- if (!objectInstance.IsObject) {
- throw new GetValueException("Target object is not class or value type");
- }
+ //if (!objectInstance.IsObject) // eg Array.Length can be called
if (!memberInfo.DeclaringType.IsInstanceOfType(objectInstance)) {
throw new GetValueException("Object is not of type " + memberInfo.DeclaringType.FullName);
}
@@ -238,9 +236,8 @@ namespace Debugger
/// Invoke the ToString() method
public string InvokeToString()
{
- if (!IsObject) {
- throw new DebuggerException("ToString can be only invoked on object");
- }
+ if (IsPrimitive) return AsString;
+ // if (!IsObject) // Can invoke on primitives
return Eval.InvokeMethod(Process, typeof(object), "ToString", this, new Value[] {}).AsString;
}
diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs
index dfe9b34ebe..db9fdb3b52 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs
@@ -38,6 +38,7 @@ namespace Debugger.Tests {
ObjectDump("array", array);
ObjectDump("array elements", array.GetArrayElements());
ObjectDump("type", array.Type);
+ ObjectDump("array.Length", array.GetMemberValue("Length"));
EndTest();
}
@@ -146,7 +147,31 @@ namespace Debugger.Tests {
-
+
+
+ null
+ System.Object
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ null
+ mscorlib.dll
+
+ System.Array
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ null
+ mscorlib.dll
+
System.Int32[]
True
True
@@ -158,6 +183,21 @@ namespace Debugger.Tests {
System.Array
+
+
+
+
+ 5
+ array.Length
+ False
+ False
+ True
+ False
+ False
+ True
+ 5
+ System.Int32
+
diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs
index c257e2cbe1..e43329f2ce 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs
@@ -124,11 +124,11 @@ namespace Debugger.Tests {
A
System.String
- -
+
-
- <null>
+ null
s_null
False
False
diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs
index fc258864f7..f27b60229f 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs
@@ -94,11 +94,11 @@ namespace Debugger.Tests {
System.String[]
- -
+
-
- <null>
+ null
n
False
False
diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PrimitiveValue.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PrimitiveValue.cs
index 6570109f68..87ac8b5963 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PrimitiveValue.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/PrimitiveValue.cs
@@ -36,6 +36,10 @@ namespace Debugger.Tests {
StartTest("PrimitiveValue.cs");
ObjectDump("locals", process.SelectedStackFrame.GetLocalVariableValues());
+ // Test System.Object access
+ ObjectDump("b as string", process.SelectedStackFrame.GetLocalVariableValue("b").InvokeToString());
+ ObjectDump("i as string", process.SelectedStackFrame.GetLocalVariableValue("i").InvokeToString());
+ ObjectDump("s as string", process.SelectedStackFrame.GetLocalVariableValue("s").InvokeToString());
EndTest();
}
@@ -66,7 +70,19 @@ namespace Debugger.Tests {
True
True
-
+
+ null
+ System.Object
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ null
+ mscorlib.dll
+
System.Boolean
False
False
@@ -93,7 +109,19 @@ namespace Debugger.Tests {
True
5
-
+
+ null
+ System.Object
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ null
+ mscorlib.dll
+
System.Int32
False
False
@@ -120,7 +148,19 @@ namespace Debugger.Tests {
True
five
-
+
+ null
+ System.Object
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ null
+ mscorlib.dll
+
System.String
False
False
@@ -147,7 +187,19 @@ namespace Debugger.Tests {
True
5.5
-
+
+ null
+ System.Object
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ null
+ mscorlib.dll
+
System.Double
False
False
@@ -161,6 +213,9 @@ namespace Debugger.Tests {
+ True
+ 5
+ five
diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/StackOverflow.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/StackOverflow.cs
index d8f40fc5d5..52ad824b5c 100644
--- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/StackOverflow.cs
+++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/StackOverflow.cs
@@ -50,7 +50,7 @@ namespace Debugger.Tests {
mscorlib.dll
StackOverflow.exe
Break
- <null>
+ null
Exception
1