You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add-Type@'namespace foo5{ public class bar { private static int fooL(System.Reflection.MethodInfo mi) { return 1; } }}'@$f= [foo5.bar] | peek
$mi= [System.Collections.ObjectModel.Collection[PSObject]].GetMethods() |? {$_.Name-eq'Add'}
$f.fooL($mi)
Expected output:
1
Actual error
Exception calling "fooL" with "1" argument(s): "Exception calling "Invoke" with "5" argument(s): "Object of type
'System.Management.Automation.PSObject' cannot be converted to type 'System.Reflection.MethodInfo'.""
At line:13 char:1
+ $f.fooL($mi)
+ ~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ScriptMethodRuntimeException
Workaround: cast arg explicitly
$f.fooL([System.Reflection.MethodInfo]$mi)
The text was updated successfully, but these errors were encountered:
Expected output:
Actual error
Workaround: cast arg explicitly
The text was updated successfully, but these errors were encountered: