-
Notifications
You must be signed in to change notification settings - Fork 234
Fix crash for finding symbols on bad paths #749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -346,9 +347,13 @@ public FindOccurrencesResult FindSymbolsInFile(ScriptFile scriptFile) | |||
{ | |||
scriptFile = workspace.GetFile(file); | |||
} | |||
catch (IOException) | |||
catch (Exception e) when (e is IOException | |||
|| e is SecurityException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does SecurityException include the "can't access due to permissions"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I foolishly trusted that it did because the FileStream
constructor docs only mention the exceptions I included here, but it looks like it doesn't >:(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes PowerShell/vscode-powershell#1518.
Protects against trying to open bad paths from
ScriptFile.GetFile()
in the symbol provider.This fixes the given issue, but might not be the best way to do so -- perhaps better for
GetFile()
to return null in this case?But we can change that at some later point perhaps.