0

I'm writing a little application on WinRT Metro Apps. I need to read an xml file and i get a awful COMException :/

This is which should read this xml:

Windows.Storage.StorageFolder storageFolder = await
   Windows.ApplicationModel.Package.Current.InstalledLocation
   .GetFolderAsync("Common");

Windows.Storage.StorageFile storageFile = await
   storageFolder.GetFileAsync("testFile.xml");

var stream = await storageFile.OpenAsync(Windows.Storage.FileAccessMode.Read);

XmlDocument doc = await XmlDocument.LoadFromAsync(storageFile);

Can somebody give me somes tips to make it work?

Kamael90
  • 43
  • 1
  • 5
  • Fairly sure the error code means that the xml document contains an invalid character. Could be a wrong encoding. Open the file in VS. – Hans Passant Apr 19 '12 at 17:40

1 Answers1

0

Why do you use OpenAsync()? (Further more, doesn't the method named LoadFromAsync exist?) Please see this Web page: How to read and write data into XML file In Metro style apps ?

By the way, error 0xC00CE508 occurs in many cases, while parsing XML. Please check that the contents of the XML have no error, by using the XmlDocument.LoadXml(String) method.

Kemal Fadillah
  • 9,760
  • 3
  • 45
  • 63
biac
  • 247
  • 1
  • 4