-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Labels
KeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-close
Description
Steps to reproduce
New-Module m {
class c {
[object] Invoke () { return Invoke-Something }
}
function Invoke-Something { 'Invoke-Something' }
function New-InstanceOfC { [c]::new() }
function Invoke-MethodOfC { (New-InstanceOfC).Invoke() }
Export-ModuleMember *OfC
} | Out-Null
(New-InstanceOfC).Invoke()
Invoke-MethodOfCExpected behavior
I expected both calls to Invoke-Something to succeed and output
Invoke-Something
Invoke-Something
Actual behavior
Neither call to Invoke-Something succeeds.
Invoke-Something : The term 'Invoke-Something' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Users\un1\Desktop\test.ps1:3 char:37
+ [object] Invoke () { return Invoke-Something }
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-Something:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Invoke-Something : The term 'Invoke-Something' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Users\un1\Desktop\test.ps1:3 char:37
+ [object] Invoke () { return Invoke-Something }
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-Something:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.6
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
KeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-close