Rama Krishna

Rama Krishna

  • NA
  • 363
  • 32.8k

Method executing at unexpected time error

Oct 3 2018 2:04 AM
Hi all,
 
Can anyone help me like when I'm reading the local storage file using async call it's not going forward from that line, If I use sync call it's giving "method executing unexpected time error"  in UWP app, Please help me on this.
 
Sample code : 
 
Task.Run(
async () =>
{
Model m = new Model();
Windows.Storage.StorageFile sf = await storageFolder.GetFileAsync(fileName);
var res = Windows.Storage.FileIO.ReadTextAsync(sf).GetResults();
var Data = JsonConvert.DeserializeObject<m>(res);
}).Wait();
 
 
Thanks in advance 

Answers (11)