I am reading a file that is periodically written by a third-party program. Im using the following FileStream:
using (FileStream fs = new FileStream( FullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
However, a third-party program writes the file, but uses FileShare.None
Therefore, sometimes I have a file for reading when a third-party program tries to open a file with exclusive access, but it does not work.
How can I read this file without causing problems for a third-party program? I would not mind letting go of my reading to give priority to another application. Any way to do this?
source share