Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception when reading text from the file using FileIO.ReadTextAsync

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?!

like image 901
Vitalij Avatar asked Dec 09 '12 22:12

Vitalij


1 Answers

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.

like image 124
Victor Laerte Avatar answered Sep 24 '22 12:09

Victor Laerte