diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs index 4622e9bb0d2..303341ca22e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DirectoryHelper.cs @@ -106,6 +106,11 @@ internal static IEnumerable GetFilteredFiles( logger?.LogWarning("PathTooLong: {exception}", ex.Message); yield break; } + catch (IOException ex) + { + logger?.LogWarning("IOException: {exception}", ex.Message); + yield break; + } foreach (var path in directories) {