You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FileSystemWatcher doesn't notice when its watched directory is renamed.
.Net Core 3.0
Windows 10 x64 1903 build 18362.10024
Code that reproduces the issue:
varpath=Path.Join(Path.GetTempPath(),Guid.NewGuid().ToString());Directory.CreateDirectory(path);usingvarwatcher=newFileSystemWatcher(path){EnableRaisingEvents=true};watcher.Changed+=(o,e)=>Console.WriteLine("Changed "+e.FullPath);watcher.Created+=(o,e)=>Console.WriteLine("Created "+e.FullPath);watcher.Deleted+=(o,e)=>Console.WriteLine("Deleted");watcher.Error+=(o,e)=>Console.WriteLine("Error");watcher.Renamed+=(o,e)=>Console.WriteLine("Renamed");varmovedPath=path+" moved";Directory.Move(path,movedPath);// Does not raise any eventsFile.WriteAllText(Path.Combine(movedPath,"file.txt"),"Hello, world!");// Raises event with incorrect FullPath (has old directory, not new one)Thread.Sleep(-1);
The text was updated successfully, but these errors were encountered:
@JeremyKuhne Even so, the problem remains that e.FullPath contains an incorrect path as shown in my example. IMHO the API is broken: it promises to give the correct full path and it doesn't but gives non-existent paths. Apparently the only portion of that property's string that is guaranteed to be correct is the very last path segment, but that's not a "full" path in any sense.
FileSystemWatcher
doesn't notice when its watched directory is renamed..Net Core 3.0
Windows 10 x64 1903 build 18362.10024
Code that reproduces the issue:
The text was updated successfully, but these errors were encountered: