diff --git a/src/PowerShellEditorServices/Workspace/Workspace.cs b/src/PowerShellEditorServices/Workspace/Workspace.cs index 6b31b094f..6f9cb8beb 100644 --- a/src/PowerShellEditorServices/Workspace/Workspace.cs +++ b/src/PowerShellEditorServices/Workspace/Workspace.cs @@ -345,6 +345,14 @@ private void RecursivelyEnumerateFiles(string folderPath, ref List found continue; } + catch (Exception e) + { + this.logger.WriteHandledException( + $"Could not enumerate files in the path '{folderPath}' due to an exception", + e); + + continue; + } foundFiles.AddRange(psFiles); } @@ -386,6 +394,15 @@ private void RecursivelyEnumerateFiles(string folderPath, ref List found return; } + catch (Exception e) + { + this.logger.WriteHandledException( + $"Could not enumerate directories in the path '{folderPath}' due to an exception", + e); + + return; + } + foreach (string subDir in subDirs) {