Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public static bool IsExcluded(FileSystemInfo fileSystemInfo, ExclusionFilters fi
return targetInfo.LastWriteTimeUtc;
}
}
catch (FileNotFoundException)
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
// The file ceased to exist between LinkTarget and ResolveLinkTarget.
// The target or the link ceased to exist between LinkTarget and ResolveLinkTarget.
}

return DateTime.MinValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,11 @@ public async Task UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink

// Act - Change link target to file 2.
File.Delete(linkPath);
try
{
File.CreateSymbolicLink(linkPath, file2Path);
File.CreateSymbolicLink(linkPath, file2Path);

// Assert - It should report the change regardless of the timestamp being older.
Assert.True(await tcs.Task,
$"Change event was not raised - current time: {DateTime.UtcNow:O}, file1 LastWriteTimeUtc: {File.GetLastWriteTimeUtc(file1Path):O}, file2 LastWriteTime: {File.GetLastWriteTimeUtc(file2Path):O}.");
}
// https://github.com/dotnet/runtime/issues/56810
catch (UnauthorizedAccessException) { }
// Assert - It should report the change regardless of the timestamp being older.
Assert.True(await tcs.Task,
$"Change event was not raised - current time: {DateTime.UtcNow:O}, file1 LastWriteTimeUtc: {File.GetLastWriteTimeUtc(file1Path):O}, file2 LastWriteTime: {File.GetLastWriteTimeUtc(file2Path):O}.");
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSymLinkSupported))]
Expand Down