-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileSystemWatcher_DirectorySymbolicLink_TargetsFile_Fails #53366
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
There is massive occurrence of failures, disabling the test. cc @jozkee |
Tagging subscribers to this area: @carlossanlop Issue DetailsStarted today. Runfo Tracking Issue: FileSystemWatcher_DirectorySymbolicLink_TargetsFile_Fails
Displaying 100 of 106 results Build Result Summary
|
@jozkee would it be possible to re-enable the test and fix it when you'll be working on other issues related to symbolic links and |
@jozkee @carlossanlop were you able to identify the source of the problem? Is this a product bug and we should fix it in 6.0? Or a flaky test and 7.0 should be fine? |
The issue is old enough that the failure results disappeared, so I can't be certain where the failure was happening. What I do know is that these new tests were added before the new symlink APIs were introduced, so it has its own logic to create unit tests, which may not be working correctly in Windows 10 if Developer Mode is not enabled. So there are two things that can be changed to ensure the tests are more reliable:
public void FileSystemWatcher_DirectorySymbolicLink_TargetsFile_Fails()
{
// Arrange
using var tempDir = new TempDirectory(GetTestFilePath());
string pathToTarget = Path.Join(tempDir.Path, Path.GetRandomFileName());
var dirLink = new DirectoryInfo(Path.Join(tempDir.Path, Path.GetRandomFileName()));
dirLink.CreateAsSymbolicLink(pathToTarget); // Create a dir link to a non-existent target (valid scenario)
var targetFile = new FileInfo(pathToTarget);
targetFile.Create().Dispose(); // Create the target as a file
using var watcher = new FileSystemWatcher(dirLink.FullName);
// Act - Assert
Assert.Throws<FileNotFoundException>(() => watcher.EnableRaisingEvents = true);
} |
@carlossanlop could you please send the PR with proposed changes? |
@carlossanlop This doesn't fail on creating the symlink. It fails when a directory symlink pointing to a file is passed to the FSW and I suggest we just remove the test since it is asserting what I think is windows undefined behavior, the undefined behavior is: "Open a directory symlink pointing to a file with CreateFileW". |
@jozkee is my understanding correct that the problem is that we might open a file (not a directory), using the following logic? runtime/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs Lines 31 to 37 in 57bfe47
If that is the case, we might want to verify if it's possible to enforce |
The problem is that |
Started today.
Runfo Tracking Issue: FileSystemWatcher_DirectorySymbolicLink_TargetsFile_Fails
Build Result Summary
The text was updated successfully, but these errors were encountered: