title: C# XmlTextWriter can't write to file
body: <p>I have a problem with the XmlTextWriter class, I can't write to a file. </p>
  
  <p>It is a console application I'm creating and the function looks like this.</p>
  
  <pre><code>private void WriteXML()
      {
          Console.WriteLine("Writing");
          using (XmlTextWriter writer = new XmlTextWriter("DataW.xml", System.Text.Encoding.UTF8))
          {
              writer.Formatting = Formatting.Indented;
              writer.WriteStartDocument();
              writer.WriteComment("This is a comment");
              writer.WriteStartElement("WeeklyReview");
  
              writer.WriteStartElement("DateTime");
              writer.WriteStartAttribute("DateTime","09/04/2018 05:00");
              writer.WriteElementString("Activity", "At Theodor");
              writer.WriteElementString("Social", "Not Theodor,Theodor");
          }
      }
  </code></pre>
  
  <p>The result I'm getting is just a file with nothing in it. And in VS 2017 the file is shown with a white background and nothing in it.</p>
  
  <p>The file I'm writing to is in the solution explorer and located in the same place as the file I'm reading from (which works).</p>