Fix a timing issue in the polling watcher

This commit is contained in:
Victor Hurdugaci 2016-06-01 16:15:55 -07:00
parent 188bf58fe8
commit 29bc240044
1 changed files with 12 additions and 5 deletions

View File

@ -117,6 +117,8 @@ namespace Microsoft.DotNet.Watcher.Core.Internal
{ {
var fileMeta = _knownEntities[fullFilePath]; var fileMeta = _knownEntities[fullFilePath];
try
{
if (fileMeta.FileInfo.LastWriteTime != f.LastWriteTime) if (fileMeta.FileInfo.LastWriteTime != f.LastWriteTime)
{ {
// File changed // File changed
@ -125,6 +127,11 @@ namespace Microsoft.DotNet.Watcher.Core.Internal
_knownEntities[fullFilePath] = new FileMeta(fileMeta.FileInfo, true); _knownEntities[fullFilePath] = new FileMeta(fileMeta.FileInfo, true);
} }
catch(FileNotFoundException)
{
_knownEntities[fullFilePath] = new FileMeta(fileMeta.FileInfo, false);
}
}
_tempDictionary.Add(f.FullName, new FileMeta(f)); _tempDictionary.Add(f.FullName, new FileMeta(f));
}); });