Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 0c99692

Browse files
committed
Increase fudge factor in FileSystemWatcher_Error_File to force the error event to occur.
I tried to be clever in the calculation, but really we don't need to be very accurate so long as we can force the error. This is still not fool-proof as it seems a stressed system may drop/coalesce some of these events (perhaps because they are touching the same file & time) but it is close enough. [tfs-changeset: 1493258]
1 parent 7b9331e commit 0c99692

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Error.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public static void FileSystemWatcher_Error_File()
6363
int internalBufferOperationCapacity = watcher.InternalBufferSize / (12 + 2 * (file.Path.Length + 1));
6464

6565
// generate enough file change events to overflow the buffer
66-
// 2x is an approximation that should force the overflow.
67-
for (int i = 1; i < internalBufferOperationCapacity * 2; i++)
66+
// 4x is an approximation that should force the overflow.
67+
for (int i = 1; i < internalBufferOperationCapacity * 4; i++)
6868
{
6969
File.SetLastWriteTime(file.Path, DateTime.Now + TimeSpan.FromSeconds(i));
7070
}

0 commit comments

Comments
 (0)