Browse Source

Update string resources;

Figured out how to box value types and primitive types

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3199 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
403efef2ae
  1. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs
  2. 22
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs
  3. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs

@ -17,7 +17,7 @@ namespace Debugger @@ -17,7 +17,7 @@ namespace Debugger
{
ICorDebugGenericValue CorGenericValue {
get {
if (!this.Type.IsPrimitive) throw new DebuggerException("Value is not a primitive type");
if (!this.Type.IsPrimitive && !this.Type.IsValueType) throw new DebuggerException("Value is not a 'generic'");
// Dereference and unbox
if (this.CorValue.Is<ICorDebugReferenceValue>()) {
@ -35,6 +35,7 @@ namespace Debugger @@ -35,6 +35,7 @@ namespace Debugger
/// </summary>
public object PrimitiveValue {
get {
if (!this.Type.IsPrimitive) throw new DebuggerException("Value is not a primitive type");
if (this.Type.IsString) {
if (this.IsNull) return null;
return this.CorValue.CastTo<ICorDebugReferenceValue>().Dereference().CastTo<ICorDebugStringValue>().String;

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

@ -86,10 +86,30 @@ namespace Debugger @@ -86,10 +86,30 @@ namespace Debugger
public Value GetPermanentReference()
{
ICorDebugValue corValue = this.CorValue;
// TODO
if (this.Type.IsClass) {
corValue = this.CorObjectValue.CastTo<ICorDebugHeapValue2>().CreateHandle(CorDebugHandleType.HANDLE_STRONG).CastTo<ICorDebugValue>();
}
if (this.Type.IsValueType || this.Type.IsPrimitive) {
if (!corValue.Is<ICorDebugReferenceValue>()) {
// Box the value type
if (this.Type.IsPrimitive) {
// Get value type for the primive type
corValue = Eval.NewObjectNoConstructor(DebugType.Create(process, null, this.Type.FullName)).CorValue;
} else {
corValue = Eval.NewObjectNoConstructor(this.Type).CorValue;
}
// Make the reference to box permanent
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference().CastTo<ICorDebugHeapValue2>().CreateHandle(CorDebugHandleType.HANDLE_STRONG).CastTo<ICorDebugValue>();
// Create new value
Value newValue = new Value(process, expression, corValue);
// Copy the data inside the box
newValue.CorGenericValue.RawValue = this.CorGenericValue.RawValue;
return newValue;
} else {
// Make the reference to box permanent
corValue = corValue.CastTo<ICorDebugReferenceValue>().Dereference().CastTo<ICorDebugHeapValue2>().CreateHandle(CorDebugHandleType.HANDLE_STRONG).CastTo<ICorDebugValue>();
}
}
return new Value(process, expression, corValue);
}

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save