-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
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)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels