@@ -670,7 +670,11 @@ private static List<CompletionResult> GetParameterCompletionResults(string param
670670 {
671671 Diagnostics . Assert ( bindingInfo . InfoType . Equals ( PseudoBindingInfoType . PseudoBindingSucceed ) , "The pseudo binding should succeed" ) ;
672672 List < CompletionResult > result = new List < CompletionResult > ( ) ;
673- Assembly commandAssembly = bindingInfo . CommandInfo . CommandMetadata . CommandType . Assembly ;
673+ Assembly commandAssembly = null ;
674+ if ( bindingInfo . CommandInfo is CmdletInfo )
675+ {
676+ commandAssembly = bindingInfo . CommandInfo . CommandMetadata . CommandType . Assembly ;
677+ }
674678
675679 if ( parameterName == string . Empty )
676680 {
@@ -809,7 +813,7 @@ private static List<CompletionResult> GetParameterCompletionResults(string param
809813 if ( pattern . IsMatch ( matchedParameterName ) )
810814 {
811815 string completionText = "-" + matchedParameterName + colonSuffix ;
812- string tooltip = parameterType + matchedParameterName + helpMessage ;
816+ string tooltip = $ " { parameterType } { matchedParameterName } { helpMessage } " ;
813817 result . Add ( new CompletionResult ( completionText , matchedParameterName , CompletionResultType . ParameterName , tooltip ) ) ;
814818 }
815819 else
@@ -823,7 +827,7 @@ private static List<CompletionResult> GetParameterCompletionResults(string param
823827 $ "-{ alias } { colonSuffix } ",
824828 alias ,
825829 CompletionResultType . ParameterName ,
826- parameterType + alias + helpMessage ) ) ;
830+ $ " { parameterType } { alias } { helpMessage } " ) ) ;
827831 }
828832 }
829833 }
@@ -899,7 +903,7 @@ private static List<CompletionResult> GetParameterCompletionResults(
899903
900904 string name = param . Parameter . Name ;
901905 string type = "[" + ToStringCodeMethods . Type ( param . Parameter . Type , dropNamespaces : true ) + "] " ;
902- string helpMessage = string . Empty ;
906+ string helpMessage = null ;
903907 bool isCommonParameter = Cmdlet . CommonParameters . Contains ( name , StringComparer . OrdinalIgnoreCase ) ;
904908 List < CompletionResult > listInUse = isCommonParameter ? commonParamResult : result ;
905909
@@ -924,7 +928,7 @@ private static List<CompletionResult> GetParameterCompletionResults(
924928 break ;
925929 }
926930
927- if ( helpMessage is not null && TryGetParameterHelpMessage ( pattr , commandAssembly , out string attrHelpMessage ) )
931+ if ( helpMessage is null && TryGetParameterHelpMessage ( pattr , commandAssembly , out string attrHelpMessage ) )
928932 {
929933 helpMessage = $ " - { attrHelpMessage } ";
930934 }
0 commit comments