title: Data at the root level is invalid. Line 1, position 1
body: <p>I am downloading a xml file from the internet and save it in isolated storage. If I try to read it I get an error: </p>
  
  <blockquote>
    <p>Data at the root level is invalid. Line 1, position 1.</p>
  </blockquote>
  
  <pre><code>string tempUrl = "http://xxxxx.myfile.xml"; // changed
  WebClient client = new WebClient();
  client.OpenReadAsync(new Uri(tempUrl));
  client.OpenReadCompleted += new OpenReadCompletedEventHandler(delegate(object sender, OpenReadCompletedEventArgs e) {
  
  StreamWriter writer = new StreamWriter(new IsolatedStorageFileStream("myfile.xml", FileMode.Create, FileAccess.Write, myIsolatedStorage));
   writer.WriteLine(e.Result);
   writer.Close();
  });
  </code></pre>
  
  <p>This is how I download and save the file...</p>
  
  <p>And I try to read it like that:</p>
  
  <pre><code>IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("myfile.xml", FileMode.Open, FileAccess.Read);
  XDocument xmlDoc = XDocument.Load(fileStream);
  </code></pre>
  
  <p>This is where I get the error...</p>
  
  <p>I have no problem reading the same file without downloading and saving it to isolated storage... so there must be the fault.</p>