MethodInvocationException: Exception calling "GetCurrent" with "0" argument(s): "A command is required to add a parameter. A command must be added to the PowerShell instance before adding a parameter."
I think this code
list = Cache.Shell.AddArgument(queries)
.AddCommand("Select-Object")
.AddParameter("ExpandProperty", "Name")
.AddCommand("Sort-Object")
.Invoke<string>();
will always cause that error. This works.
list = Cache.Shell.AddCommand("Select-Object")
.AddParameter("ExpandProperty", "Name")
.AddCommand("Sort-Object")
.Invoke<string>(queries);
Steps to reproduce
Expected behavior
List of queries
Actual behavior
I think this code
will always cause that error. This works.