title: An unhandled exception of type 'System.StackOverflowException' occurred in .dll that used in client applcation
body: <p>I am using one of the .dll in my application and when I try to debug the code below of the .dll ,I am getting an error as given below when try to execute the "serializer.Serialize(writer, preAdvice); " portion.</p>
  
  <blockquote>
    <p>"An unhandled exception of type 'System.StackOverflowException'"</p>
  </blockquote>
  
  <pre><code>PreAdviceOrder preAdvice = new PreAdviceOrder();
  preAdvice.Items = purchaseOrders.ToArray();
  XmlSerializer serializer = new XmlSerializer(preAdvice.GetType());
  //fs = new FileStream(_fileName, FileMode.Create, FileAccess.Write);
  //serializer.Serialize(fs, preAdvice);
  var writer = new XmlTextWriter(_fileName, Encoding.UTF8);
  serializer.Serialize(writer, preAdvice);
  </code></pre>
  
  <p>Can anyone help to find what the exact issue is?</p>