Skip to content

Commit

Permalink
Safely handle DirectoryNotFound (#2008)
Browse files Browse the repository at this point in the history
* Safely handle DirectoryNotFound
Fixes https://github.com/dotnet/aspnetcore/issues/22795
  • Loading branch information
TanayParikh authored Jun 11, 2020
1 parent 5dcab1f commit 3fcf280
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace
throw new IOException($"File was externally modified: {_filePath}");
}
}
catch (FileNotFoundException)
catch (IOException e) when (e is DirectoryNotFoundException || e is FileNotFoundException)
{
// This can typically occur when a file is renamed. What happens is the client "closes" the old file before any file system "rename" event makes it to us. Resulting
// in us trying to refresh the "closed" files buffer with what's on disk; however, there's nothing actually on disk because the file was renamed.
Expand Down

0 comments on commit 3fcf280

Please sign in to comment.