title: StackOverFlowException during Serialization
body: <p>I trying to serialize a custom type which holds a dictionary among other members. The types associated with key and value of the dictionary are interfaces which are implemented.</p>
  
  <p>The dictionary looks like</p>
  
  <pre><code> Dictionary&lt;ITypeA, ITypeA&gt; 
  
  TypeA implements ITypeA, 
  SubTypeOfA inherits from TypeA
  SubTypeOfB inherits from SubTypeOfA
  </code></pre>
  
  <p>pseudo code looks something like this:</p>
  
  <pre><code>            List&lt;Type&gt; knownTypes = new List&lt;Type&gt;() { 
                  typeof(TypeA), 
                  typeof(SubTypeOfA),
                  typeof(SubTypeOfB)
              };
  
  DataContractSerializer serializer =
                  new DataContractSerializer(typeof(DataHolder), knownTypes);
  
              using (FileStream fs = new FileStream(completeFilePath, FileMode.Create))
              {
                  serializer.WriteObject(fs, templateData);
                  success = true;
              }
  </code></pre>
  
  <p>I get a StackOverflowException when WriteObject() is getting called, am clueless on what is causing that to happen.</p>
  
  <p>All the classes in the hierarchy are decorated with [DataContract] and the members to be serialized are decoreated with [DataMember]. </p>
  
  <p>Any help would be appreciated.</p>