title: Can anyone explain to me why the following code throws System.Reflection.AmbiguousMatchException?
body: <pre><code>using System;
  using System.Reflection;
  
  namespace A
  {
    interface IObjectWithId&lt;TId&gt;
    {
      TId Id { get; }
    }
    interface IEntityBase : IObjectWithId&lt;object&gt;
    {
      new object Id { get; }
    }
    abstract class BusinessObject&lt;TId&gt; : IObjectWithId&lt;TId&gt;
    {
      public abstract TId Id { get; }
    }
    class EntityBase : BusinessObject&lt;object&gt;, IEntityBase
    {
      public override object Id { get { return null; } }
    }
  
    public static class Program
    {
      public static void Main()
      {
        Console.WriteLine(typeof(EntityBase).GetProperty("Id", BindingFlags.Instance | BindingFlags.Public));
      }
    }
  }
  </code></pre>
  
  <p>I am getting this:</p>
  
  <pre><code>System.Reflection.AmbiguousMatchException was unhandled
    Message="Ambiguous match found."
    Source="mscorlib"
    StackTrace:
         at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
         at System.Type.GetProperty(String name, BindingFlags bindingAttr)
         at A.Program.Main() in C:\Home\work\A\Program.cs:line 26
    InnerException: 
  </code></pre>
  
  <blockquote>
    <p>Microsoft Visual Studio 2008<br>
    Version 9.0.30729.1 SP<br>
    Microsoft .NET Framework<br>
    Version 3.5 SP1  </p>
  </blockquote>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Strangely enough, looks like other folks fail to reproduce it. Though it does crash on my machine every time. I found out that this code:</p>
  
  <pre><code>Console.WriteLine(typeof(EntityBase).GetProperty("Id", BindingFlags.Instance | BindingFlags.Public, null, typeof(object), Type.EmptyTypes, null));
  </code></pre>
  
  <p>Does work OK, although it should be the same.</p>