I need to modify a text file from multiple .NET processes, nothing I’ve tried works reliably. I have a C# GUI app which starts multiple processes to do some number crunching. Those need to append lines to the same text file every few milliseconds. The master process monitors the size of the file and once it reaches some threshold uploads it and deletes it.
The way these are currently coded, the processes that append text create the file if it doesn’t exist, but that would be easy to change.
How can I implement this?
This method will repeatedly attempt to open the file until it can write to it, timing out after 10ms.