MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
445 stars 155 forks source link

Fix #365 #366

Closed jhoneill closed 3 years ago

jhoneill commented 3 years ago

PR Summary

It appears this

               list = Cache.Shell.AddArgument(queries)
                                 .AddCommand("Select-Object")
                                 .AddParameter("ExpandProperty", "Name")
                                 .AddCommand("Sort-Object")
                                 .Invoke<string>();

Is the wrong way to pass queries down the pipeline into select-object and causes A command is required to add a parameter. A command must be added to the PowerShell instance before adding a parameter.

It's fixed by changed to calling the command like this.

list = Cache.Shell.AddCommand("Select-Object")
                                 .AddParameter("ExpandProperty", "Name")
                                 .AddCommand("Sort-Object")
                                 .Invoke<string>(queries);

PR Checklist

DarqueWarrior commented 3 years ago

Do you have an example where you get that error? I have not seen that error.

jhoneill commented 3 years ago

Do you have an example where you get that error? I have not seen that error.

The completer for queries doesn't use the cache, so I don't think anything is calling it, meaning the error isn't visible - I can't recall why I tried to the access the cache directly.