title: Func-eval on polymorphic classes
body: <p>I'm making a managed .NET debugger using MDBG sample.</p>
  
  <p>MDBG sample operates only on top level class of given instance, not searching deep inside class hierarchy. I was able to go through hierarchy and get all available methods. But a problem occurs in such case:</p>
  
  <pre><code>    public abstract class Base{
          public Base() {SomeProp = "Base"}
          public string SomeProp {get;set;}
      }
  
      public class A : Base{
          public Base() {SomeProp = "A"}
          public new string SomeProp {get;set;}
      }
  
      public static void Main(){
          var a = new A();
          var castedToBase = (Base)a;
          //castedToBase.SomeProp -- expect result to be "Base" when debugging
      }
  </code></pre>
  
  <p>The problem is when I'm getting castedToBase as ICorDebugValue and query for it's ICorDebugValue2::GetExactType I get A class instead of Base class. 
  At that point I cannot distinguish any more which method get_SomeProp to invoke. I would expect ICorDebugValue2::GetExactType to take in consideration performed casts and not return always the underlying type.</p>
  
  <p><strong>How can I understand which method I should invoke?</strong></p>
  
  <p>Some code of what I'm doing now is listed below. <strong>mdbgValue</strong> represents castedToBase object. szTypedef returns "A" instead of expected "Base"</p>
  
  <pre><code>    IMetadataImport importer;
      var classToken = mdbgValue.CorValue.ExactType.Class.Token;
  
      int size;
      int ptkExtends;
      TypeAttributes pdwTypeDefFlags;
      importer.GetTypeDefProps(classToken,
          null,
          0,
          out size,
          out pdwTypeDefFlags,
          out ptkExtends
          );
      StringBuilder szTypedef = new StringBuilder(size);
      importer.GetTypeDefProps(classToken,
          szTypedef,
          szTypedef.Capacity,
          out size,
          out pdwTypeDefFlags,
          out ptkExtends
          );
  </code></pre>