I have a FileSystemWatcherlistening folder. When I try to rename this folder (in Windows Explorer), I get
The action cannot be performed because the folder or file in it is opened in another program
error.
Commenting calls FileSystemWatchercorrects this.
I tried to reproduce the error with a simple program, but was unsuccessful, so I'm not sure what is going on here. Has anyone come across anything similar with FileSystemWatcher? If so, what could be the reason?
Additional Information:
The following seems to be enough to cause an error:
FileSystemWatcher fsw = new FileSystemWatcher(path);
fsw.Deleted += new FileSystemEventHandler(fsw_Deleted);
fsw.EnableRaisingEvents = true;
I can rename files in this folder. And the native files. I even tried to put return;as the first line in fsw_Deleted. Still not working. Like not closing Visual Studio, removing obj and bin, and starting it again. And I even tried to run the executable file not in VS. Nevertheless - there is no lock if it does not work, it is locked if it is.
source
share