I am writing to a file, then reading it back right after:
await FileIO.WriteTextAsync(file, command, Windows.Storage.Streams.UnicodeEncoding.Utf8);
var readFile = await ApplicationData.Current.TemporaryFolder.GetFileAsync(WEB_LOG);
However, GetFileAsync
throws a FileNotFoundException
because the file hasn't appeared yet. If I use the debugger and wait a little after WriteTextAsync
finishes, I can see the file appear in the folder and GetFileAsync
does not throw an exception. How can I wait for the file to be fully written to and appear in the folder so that GetFileAsync
does not throw an exception?