title: Fastmember access non public properties
body: <p>I wanted to replace my reflection index accessor with FastMember (<a href="https://www.nuget.org/packages/FastMember/" rel="nofollow noreferrer">https://www.nuget.org/packages/FastMember/</a>) but stumbled across the following problem.</p>
  
  <p>I have the following setup:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var d = new DerivedClass
          {
              Name = "Derived Name Property",
              BaseName = "Base Name Property",
              BaseInternalName = "Base Internal Name Property",
          };
  
          Console.WriteLine(d["Name"]);
          Console.WriteLine(d["BaseName"]);
          Console.WriteLine(d["BaseInternalName"]);
          Console.ReadLine();
      }
  }
  
  public abstract class BaseClass
  {
      public object this[string propertyName]
      {
          get
          {
              var x = GetTypeAccessor();
              return x[this, propertyName];
          }
          set
          {
              var x = GetTypeAccessor();
              x[this, propertyName] = value;
          }
      }
  
      protected abstract TypeAccessor GetTypeAccessor();
  
      public string BaseName { get; set; }
      internal string BaseInternalName { get; set; }
  }
  public class DerivedClass : BaseClass
  {
      public string Name { get; set; }
  
      private TypeAccessor _typeAccessor;
  
      protected override TypeAccessor GetTypeAccessor()
      {
          if (_typeAccessor == null)
              _typeAccessor = TypeAccessor.Create(this.GetType(), true);
  
          return _typeAccessor;
      }
  }
  </code></pre>
  
  <p>With this I am getting the following exception, on the line <code>Console.WriteLine(d["BaseInternalName"]);</code></p>
  
  <p><strong>An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in FastMember_dynamic</strong></p>
  
  <p>Innerexception is null.</p>
  
  <p>According to nuget <a href="https://www.nuget.org/packages/FastMember/" rel="nofollow noreferrer">https://www.nuget.org/packages/FastMember/</a> there should be support for accessing non public properties, since version 1.0.0.8:</p>
  
  <ul>
  <li>1.0.0.8 - provide support for non-public accessors
  (at least I think that's the meaning)</li>
  </ul>
  
  <p>Another thing I noticed is that in nuget it is saying that 1.0.0.11 is the newest version, but the dll that gets downloaded to my computer on <code>Install-Package FastMember</code> has the version 1.0.0.9, maybe marc <a href="https://stackoverflow.com/users/23354/marc-gravell">https://stackoverflow.com/users/23354/marc-gravell</a> sees this and can fix it. :)</p>