title: WriteStartDocument() throws InvalidOperationException
body: <p>I'm trying to generate XML and I encounter this exception:</p>
  
  <pre><code>XmlTextWriter xmlWriter = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
  
  xmlWriter.WriteStartDocument();
  xmlWriter.WriteStartElement("userInfo");
  </code></pre>
  
  <p>It gives me an exception: </p>
  
  <p><code>WriteStartDocument needs to be the first call.</code></p>
  
  <p>But as you can see, I did call the WriteStartDocument() first!</p>
  
  <p>Any ideas?</p>