title: NullRefrenceException using reflection in the view and custom attributes on the model
body: <p>I am getting a <code>NullReferenceException</code> in the following scenario</p>
  
  <p>Test class:</p>
  
  <pre><code>[Order(0)]
  public class Test
  {
      [DisplayName("District Code")]
      [Editable(false)]
      [HiddenInput(DisplayValue = false)]
      public int DistrictCode { get; set; }
  
      [Required(ErrorMessage = "Error")]
      [Editable(false)]
      [ReadOnly(true)]
      [Order(2)]
      public string Subject { get; set; }
  }
  </code></pre>
  
  <p>Custom Order Attribute:</p>
  
  <pre><code>public class Order : Attribute
  {
      public int Display { get; set; }
      public int Edit { get; set; }
      public int Create { get; set; }
  
      public Order(int all)
      {
          this.Display = all;
          this.Edit = all;
          this.Create = all;
      }
  }
  </code></pre>
  
  <p>And I have the following foreach loop (Unrelated code removed for brevity):</p>
  
  <pre><code>@foreach (PropertyInfo prop in Model.GetType().GetProperties()
           .Where(x =&gt; !x.GetCustomAttributes(typeof(HiddenInputAttribute)).Any()))
  {
      prop.GetCustomAttributes(typeof(Order), True)
          .GetType().GetProperty("Edit").GetValue(prop);
  }
  </code></pre>
  
  <p>When I QuickWatch <code>prop.GetCustomAttributes(typeof(Order), True).GetType()</code> I get what I expect. But if I QuickWatch <code>prop.GetCustomAttributes(typeof(Order), True).GetType().GetProperty("Edit")</code> I get <code>null</code> back.</p>
  
  <p>Why is can reflection not find the property <code>Edit</code> or could this actually be a different problem</p>