FileIO.ReadTextAsync gives error


  • As part of a method in my app, I have this piece of code:

               StorageFile bookFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/AV/" + bookName + ".txt"));
                string content = await FileIO.ReadTextAsync(bookFile);

    The second line always gives an error although I don't see the error message. It just stops. I know this because I set a breakpoint at the first line of the method (which is just the line before the above). Someone suggested on StackOverflow that I confirm that bookFile is not null. I checked it during the breakpoint and it has a value.

    What am I doing wrong? Is there any other way of reading the content of an asset?

    Tuesday, June 24, 2014 2:00 PM

All replies

  • That looks basically right (other than using "await" in an HTML5/JavaScript app :) I'll move this to the right forum for you). To get better debugging information turn off just-my-code in the debug options and use the mixed mode debugger.

    Tuesday, June 24, 2014 11:05 PM