c# - Writing/Reading To/From File Windows 8.1 AppStore App -
i have windows 8.1 app want write , read xml file put in "assets" folder in application package.
i call following method page constructor after this.initializecomponent();
line:
private async void readxml() { var uri = new system.uri("ms-appdata:///assets/gameinfo.xml"); storagefile file = await windows.storage.storagefile.getfilefromapplicationuriasync(uri); xmldocument reader = new xmldocument(); reader.loadxml(file.tostring()); xmlnodelist nodes = reader.documentelement.childnodes; string attr = nodes[0].attributes[0].innertext; int besttime; if (attr != null && int.tryparse(attr, out besttime)) besttime = besttime; }
when navigate page contains code , runs argumentexception thrown on storagefile file...
line. here exception detail:
system.argumentexception unhandled user code hresult=-2147024809 message=value not fall within expected range. source=mscorlib stacktrace: @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter`1.getresult() @ lightsoutapp.random4x4.<readxml>d__0.movenext() innerexception:
does have idea why exception being thrown? thank help.
i tried doing ms-app in stead of ms-appdata , fixed error. thank help.
Comments
Post a Comment