Description
Issue Description
I have observed that the reference counter does not count when the function is being used as a scriptblock or as parameter in Get-Command, see example1.
Also if you reimpliment the function, the counter will be 1 for both, see example2.
Attached Example
1
0 references
function foo {
Write-Output 0
}
Invoke-Command -ComputerName . -ScriptBlock $Function:foo
Get-Command foo
2
1 reference
function foo {
Write-Output 0
}
1 reference
function foo {
Write-Output 0
}
Environment Information
Visual Studio Code
Name | Version |
---|---|
Operating System | Windows_NT x64 10.0.16299 |
VSCode | 1.26.0 |
PowerShell Extension Version | 1.8.2 |
PowerShell Information
Name | Value |
---|---|
PSVersion | 5.1.16299.551 |
PSEdition | Desktop |
PSCompatibleVersions | 1.0 2.0 3.0 4.0 5.0 5.1.16299.551 |
BuildVersion | 10.0.16299.551 |
CLRVersion | 4.0.30319.42000 |
WSManStackVersion | 3.0 |
PSRemotingProtocolVersion | 2.3 |
SerializationVersion | 1.1.0.1 |
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
Extension | Author | Version |
---|---|---|
beautify | HookyQR | 1.3.2 |
better-comments | aaron-bond | 1.2.6 |
code-runner | formulahendry | 0.9.4 |
code-settings-sync | Shan | 3.0.0 |
code-spell-checker | streetsidesoftware | 1.6.10 |
csharp | ms-vscode | 1.15.2 |
debugger-for-chrome | msjsdiag | 4.8.2 |
gitlens | eamodio | 8.5.4 |
material-icon-theme | PKief | 3.5.2 |
mssql | ms-mssql | 1.4.0 |
npm-intellisense | christian-kohler | 1.3.0 |
perforce | slevesque | 3.1.0 |
PowerShell | ms-vscode | 1.8.2 |
project-manager | alefragnani | 8.0.0 |
rest-client | humao | 0.19.1 |
tslint | eg2 | 1.0.34 |
vscode-markdownlint | DavidAnson | 0.19.0 |
vscode-npm-script | eg2 | 0.3.5 |
xml | DotJoshJohnson | 2.3.1 |