Skip to content

Catch RuntimeException when getting signatures with bad attribute #475

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

Merged
merged 1 commit into from
May 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/PowerShellEditorServices/Language/LanguageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,15 @@ await CommandHelpers.GetCommandInfo(
IEnumerable<CommandParameterSetInfo> commandParamSets = commandInfo.ParameterSets;
return new ParameterSetSignatures(commandParamSets, foundSymbol);
}
catch (RuntimeException e)
{
// A RuntimeException will be thrown when an invalid attribute is
// on a parameter binding block and then that command/script has
// its signatures resolved by typing it into a script.
Logger.WriteException("RuntimeException encountered while accessing command parameter sets", e);

return null;
}
catch (InvalidOperationException)
{
// For some commands there are no paramsets (like applications). Until
Expand Down