Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用户代码(HRESULT:0xC00CE508的异常)win8 metro应用程序未处理COMException_Com_Windows 8_Microsoft Metro_Windows Runtime_Xmlreader - Fatal编程技术网

用户代码(HRESULT:0xC00CE508的异常)win8 metro应用程序未处理COMException

用户代码(HRESULT:0xC00CE508的异常)win8 metro应用程序未处理COMException,com,windows-8,microsoft-metro,windows-runtime,xmlreader,Com,Windows 8,Microsoft Metro,Windows Runtime,Xmlreader,我正在WinRT Metro应用程序上编写一个小应用程序。我需要读取一个xml文件,我得到了一个可怕的例外:/ 这是应该读取此xml的文件: Windows.Storage.StorageFolder storageFolder = await Windows.ApplicationModel.Package.Current.InstalledLocation .GetFolderAsync("Common"); Windows.Storage.StorageFile storag

我正在WinRT Metro应用程序上编写一个小应用程序。我需要读取一个xml文件,我得到了一个可怕的例外:/

这是应该读取此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);
有人能给我一些建议让它工作吗?

为什么要使用OpenAsync?此外,名为LoadFromAsync的方法不存在吗? 请参阅本网页:


顺便说一下,解析XML时,在许多情况下都会发生错误0xC00CE508。请使用XmlDocument.LoadXmlString方法检查XML的内容是否没有错误

非常确定错误代码意味着xml文档包含无效字符。可能是错误的编码。在VS中打开文件。