title: ProtoBuf, inheritance and generics
body: <p>Given the following code:</p>
  
  <pre><code>[Serializable, ProtoContract]
  [ProtoInclude(100, typeof(ValueA))]
  [ProtoInclude(101, typeof(ValueB))]
  public class Value
  {
  }
  
  [Serializable, ProtoContract]
  public class ValueA : Value
  {
  }
  
  [Serializable, ProtoContract]
  public class ValueB : Value
  {
  }
  
  [Serializable, ProtoContract]
  [ProtoInclude(1000, typeof(ContainerA))]
  [ProtoInclude(1001, typeof(ContainerB))]
  public class Container&lt;T&gt; where T : Value
  {
      [ProtoMember(1)]
      public T Item;
  }
  
  [Serializable, ProtoContract]
  public class ContainerA : Container&lt;ValueA&gt;
  {
  }
  
  [Serializable, ProtoContract]
  public class ContainerB : Container&lt;ValueB&gt;
  {
  }
  </code></pre>
  
  <p>I get an error when trying to serialize ContainerA/ContainerB:</p>
  
  <blockquote>
    <p>ProtoBuf.ProtoException : Known-type
    ContainerB for ProtoIncludeAttribute
    must be a direct subclass of
    Container`1</p>
  </blockquote>
  
  <p>Commenting out one of the following lines - so that only one class inherits from Container - will make ProtoBuf happy again:</p>
  
  <pre><code>[ProtoInclude(1000, typeof(ContainerA))]
  [ProtoInclude(1001, typeof(ContainerB))]
  </code></pre>
  
  <p>What's going on here an what can be done about it?</p>
  
  <p>TIA</p>