title: "Object does not match target type" exception when reflecting over object properties
body: <p>I'm updating some code so that it reflects into the models it receives and figures out what properties to write out fields in a PDF file rather than me subclassing and manually mapping the fields for each and every PDF. The problem is that I can't get the property's value because of an <code>Object does not match target type</code> exception. Looking through similar questions on SO it seems like a simple fix, but just doesn't want to work. Here's my code that I'm testing through LINQPad:</p>
  
  <pre><code>var pdf = typeof(PdfModel2);
  
  pdf.GetProperties().Where(
      p =&gt;
          p.GetCustomAttribute&lt;PdfTextFieldAttribute&gt;() != null).Select(
      p =&gt;
          p.GetValue(pdf)).Dump();
  </code></pre>
  
  <p>Can someone point me where I'm going wrong here? Is it because the <code>PdfModel2</code> class I'm reflecting over has properties its inheriting from a base class?</p>