Browse Source

Fixed NotSupportedException when stepping into a decompiled generic method. (crash #3606)

4.2
Daniel Grunwald 14 years ago
parent
commit
e8ca5763fa
  1. 7
      src/AddIns/Debugger/Debugger.Core/IDStringProvider.cs
  2. 7
      src/AddIns/Debugger/Debugger.Core/MetaData/DebugMethodInfo.cs

7
src/AddIns/Debugger/Debugger.Core/IDStringProvider.cs

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using Debugger.MetaData;
namespace Debugger namespace Debugger
{ {
@ -42,7 +43,11 @@ namespace Debugger
MethodInfo mr = (MethodInfo)member; MethodInfo mr = (MethodInfo)member;
if (mr.IsGenericMethod) { if (mr.IsGenericMethod) {
b.Append("``"); b.Append("``");
b.Append(mr.GetGenericArguments().Length); // DebugMethodInfo does not implement GetGenericArguments
if (mr is DebugMethodInfo)
b.Append(((DebugMethodInfo)mr).GenericParameterCount);
else
b.Append(mr.GetGenericArguments().Length);
} }
parameters = mr.GetParameters(); parameters = mr.GetParameters();
if (mr.Name == "op_Implicit" || mr.Name == "op_Explicit") { if (mr.Name == "op_Implicit" || mr.Name == "op_Explicit") {

7
src/AddIns/Debugger/Debugger.Core/MetaData/DebugMethodInfo.cs

@ -195,6 +195,13 @@ namespace Debugger.MetaData
get { return this.MethodDefSig.GenericParameterCount > 0; } get { return this.MethodDefSig.GenericParameterCount > 0; }
} }
/// <summary>
/// Gets the number of generic parameters on this method.
/// </summary>
public int GenericParameterCount {
get { return this.MethodDefSig.GenericParameterCount; }
}
/// <inheritdoc/> /// <inheritdoc/>
public override RuntimeMethodHandle MethodHandle { public override RuntimeMethodHandle MethodHandle {
get { throw new NotSupportedException(); } get { throw new NotSupportedException(); }

Loading…
Cancel
Save