I have a UWP app (Target/Min version 16299). I am appending lines to a single file using FileIO.AppendTextAsync(file, contents)
, and possibly across more than 1 thread (although I've tried forcing every call onto the same thread and this has no effect). The file definitely exists and some lines do get written but every now and again this throws an Exception
with the message Unable to remove the file to be replaced. (Exception from HRESULT: 0x80070497)
. Using an AsyncLock around this code doesn't seem to have any affect either.
I have found a handful of posts about this issue but no answer that looks relevant. What am I missing here?
User contributions licensed under CC BY-SA 3.0