I have a Powershell script where I would like to create a generic List of a type that is defined in a custom (C++/CLI) assembly.
If I run new-object My.Namespace.MyClass, I can create objects all day. However, if I run new-genericobject System.Collections.Generic.List -Of My.Namespace.MyClass, I get the below error:
New-GenericObject : Could not construct Closed Type using the provided arguments.
At line:1 char:18
+ new-genericobject <<<< System.Collections.Generic.List -Of My.Namespace.MyClass
+ CategoryInfo : NotSpecified: (:) [New-GenericObject], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Pscx.Commands.NewGenericObjectCommand
I can create lists of strings, so the basic functionality of new-genericobject is fine. Does anyone have ideas on what this error means and how it can be resolved?