My application parses log files but when trying to parse the current day's file I get an error stating that the file is being used by another process. This log file is currently being written to and can be accessed through notepad but not through my application.
Current Code:
Stream stream = new FileStream(fileToRead, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(stream);
Also tried this but had no luck:
Stream stream = new FileStream(fileToRead, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
What changes need to be to my code in order to READ a file that is being used by another process. Copying the log file is not a solution due to the size of the log and performance of my application