In fact, there is no such thing as thread safety without determining which operations are used.
If all threads (and processes!) Just read the file anyway, reading is safe. If, however, some streams (or other processes) are written to a file, you can get the semi-task information, you never know how the recording is organized.
For more failsafe access, you can use
using (var s = new FileStream(..., FileMode.Open, FileAccess.Read, FileShare.None)) using (var tr = new StreamReader(s)) { content = tr.ReadToEnd(); }
The documentation for File.ReadAllText says nothing and, therefore, nothing guarantees locking.
Vlad
source share