Skip to content

Commit

Permalink
Fix crash for finding symbols on bad paths (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmholt authored Sep 20, 2018
1 parent 8bf5c9c commit 13f2107
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/PowerShellEditorServices/Language/LanguageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Management.Automation;
using System.Management.Automation.Language;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -346,9 +347,14 @@ public async Task<FindReferencesResult> FindReferencesOfSymbol(
{
scriptFile = workspace.GetFile(file);
}
catch (IOException)
catch (Exception e) when (e is IOException
|| e is SecurityException
|| e is FileNotFoundException
|| e is DirectoryNotFoundException
|| e is PathTooLongException
|| e is UnauthorizedAccessException)
{
// If the file has ceased to exist for some reason, we just skip it
// If we can't access the file for some reason, just ignore it
continue;
}

Expand Down

0 comments on commit 13f2107

Please sign in to comment.