From e9895795930e9223fed0f9fae61316087742de9a Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Thu, 31 Jan 2019 19:50:58 -0700 Subject: [PATCH] Catch NotSupportedException which can be thrown by FilleStream ctor The 7 exceptions that are caught now are doc'd in: https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream.-ctor?view=netframework-4.7.2#System_IO_FileStream__ctor_System_String_System_IO_FileMode_System_IO_FileAccess_ --- src/PowerShellEditorServices/Workspace/Workspace.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PowerShellEditorServices/Workspace/Workspace.cs b/src/PowerShellEditorServices/Workspace/Workspace.cs index 6f9cb8beb..d81f9f5e7 100644 --- a/src/PowerShellEditorServices/Workspace/Workspace.cs +++ b/src/PowerShellEditorServices/Workspace/Workspace.cs @@ -148,11 +148,12 @@ public bool TryGetFile(string filePath, out ScriptFile scriptFile) return true; } catch (Exception e) when ( - e is IOException || - e is SecurityException || + e is NotSupportedException || e is FileNotFoundException || e is DirectoryNotFoundException || e is PathTooLongException || + e is IOException || + e is SecurityException || e is UnauthorizedAccessException) { this.logger.WriteHandledException($"Failed to get file for {nameof(filePath)}: '{filePath}'", e);