title: StreamWriter along with XmlSerializer in DotNet6 does not write WhiteSpaces?
body: <p>Actually I tried this basic code in C# which serializes the DataSet into XML document.</p>
  <pre class="lang-cs prettyprint-override"><code>static void Main(string[] args)
  {
      XmlSerializer ser = new XmlSerializer(typeof(DataSet));
  
      // Creates a DataSet; adds a table, column, and ten rows.
      DataSet ds = new DataSet(&quot;myDataSet&quot;);
      DataTable t = new DataTable(&quot;table1&quot;);
      DataColumn c = new DataColumn(&quot;thing&quot;);
      t.Columns.Add(c);
      ds.Tables.Add(t);
      DataRow r;
      for (int i = 0; i &lt; 10; i++)
      {
          r = t.NewRow();
          r[0] = &quot;Thing &quot; + i;
          t.Rows.Add(r);
      }
      StreamWriter writer = new StreamWriter(&quot;DemoNet5.xml&quot;);
      ser.Serialize(writer, ds);
      writer.Close();
  }
  </code></pre>
  <p>And this creates the &quot;DemoNet5.xml&quot; file with proper WhiteSpaces and Indentation in .NET 5. But When I try to run the same code in .NET 6
  I am not getting the WhiteSapces and Indentation so that the contents    of the xml are written in single line.</p>
  <p>Later on when I try to read that .xml document I face issues.
  Is there someone who can help me with this ? I want my xml contents to be in proper format that is with proper indetation and WhiteSpaces.
  <a href="https://i.stack.imgur.com/owurW.png" rel="nofollow noreferrer">Xml file created using .NET6</a>
  I have also attached the XML document created using DotNet6.</p>