Exception when reading text from the file using FileIO.ReadTextAsync

12

I am getting the following exception when attempting to read a locl text file using

var text = await FileIO.ReadTextAsync(file);

The handle with which this oplock was associated has been closed. The oplock is now broken. (Exception from HRESULT: 0x80070323)

This happens in one of the regression unit tests, it also happens from time to time in the app. App is XAML + C#

Any ideas what might be causing it?!

c#
windows-runtime
windows-store-apps
asked on Stack Overflow Dec 9, 2012 by Vitalij • edited Dec 10, 2012 by Vitalij

1 Answer

8

I was having the same problem, that ocurred by concurrence threading. I was trying to acess the same file in two places at the same time and didn't realize it.

Try to verify your code looking for some another acess to the same file and verify if you are closing after read it, and don't forget to call "await" or use a lock in every file reading. I think it may solve your issue.

answered on Stack Overflow Sep 9, 2013 by Victor Laerte • edited Feb 9, 2014 by Victor Laerte

User contributions licensed under CC BY-SA 3.0