title: Postsharp/Reflection Conflict
body: <p>I wanted to make 2 basic classes <code>Entity</code> and <code>EntityCollection</code> and to inherent all my data classes from them. In Entity class constructor I wanted to call this method:</p>
  
  <pre><code>   public static void InitAllCollection(Object o)
      {
          foreach (var propertyInfo in o.GetType().GetRuntimeProperties())
          {
              if (!propertyInfo.PropertyType.IsConstructedGenericType ||
                  propertyInfo.PropertyType.GetGenericTypeDefinition() != typeof (EntityCollection&lt;&gt;)) continue;
  
              var ctor = propertyInfo.PropertyType.GetTypeInfo().DeclaredConstructors
                  .Where(c =&gt; !c.GetParameters().Any())
                  .Select(c =&gt; c).FirstOrDefault();
              propertyInfo.SetValue(o, ctor.Invoke(new object[0]));
          }
      }
  </code></pre>
  
  <p>This method was automatically init all <code>EntityCollection</code> member of entity, so I don't need to duplicate code.</p>
  
  <p>And everything worked fine until I introduces post sharp aspect of <code>NotifyPropertyChanged</code> aspect. After that calling<code>propertyInfo.SetValue(o, ctor.Invoke(new object[0]));</code> is trowing <code>TargetInvocationException</code>.</p>
  
  <p>Can I somehow tell postsharp to exclude <code>EntityCollection</code> generics or at least to exlude them before constrictor is finished.</p>
  
  <p><strong>EDIT:</strong> <code>InitAllCollection</code> method is called during <code>Entity</code> constructor. Also it is project for Windows 8.1</p>