Long path support with file system watcher
In our client application implemented in C# with .Net framework 4.8 (OS: Windows 10), we are using file system watcher control to detect folder's events. To support a long path we have tried with \?\ in folder path. When we create a new file in long path, file system watcher detects "Created" event and it returns correct format of full path. However when we delete the file from long path, watcher control's "Deleted" event fires but it returns the full path having ~ tilde in folder's names and in file name. e.g \?\C:\abc\FIRSTF~1\SECOND~1\THIRDF~1\FOURTH~1\FIFTHF~1....\AVIA~1.jpg
We have tried below win32 method to get correct full path, however its not returning full path, [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] private static extern Int32 GetLongPathName(String shortPath, StringBuilder longPath, Int32 longPathLength);
Can anybody please suggest is there any upgrade version of file system watcher control to support long path or any other alternatives to get correct long path on file's delete or rename event? Any help would be appreciated.