diff --git a/src/PowerShellEditorServices/Language/LanguageService.cs b/src/PowerShellEditorServices/Language/LanguageService.cs index f7c78f112..5dfad5aa4 100644 --- a/src/PowerShellEditorServices/Language/LanguageService.cs +++ b/src/PowerShellEditorServices/Language/LanguageService.cs @@ -6,7 +6,6 @@ using Microsoft.PowerShell.EditorServices.Symbols; using Microsoft.PowerShell.EditorServices.Utility; using System; -using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; @@ -699,6 +698,15 @@ await this.powerShellContext.GetRunspaceHandle( this.areAliasesLoaded = true; } + catch (PSNotSupportedException e) + { + this.logger.Write( + LogLevel.Warning, + $"Caught PSNotSupportedException while attempting to get aliases from remote session:\n\n{e.ToString()}"); + + // Prevent the aliases from being fetched again - no point if the remote doesn't support InvokeCommand. + this.areAliasesLoaded = true; + } catch (TaskCanceledException) { // The wait for a RunspaceHandle has timed out, skip aliases for now