PowerShell / PowerShell/vscode-powershell

Command Explorer lists multiple commands with the same name

Open
#1,685 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Command Explorer Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

System Details

System Details Output

### VSCode version: 1.31.0-insider 28e7467661d67c05c3662ff900ee1984f7e2fbcc x64
(node:27697) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

### VSCode extensions:
DavidAnson.vscode-markdownlint@0.23.0
EditorConfig.EditorConfig@0.12.6
eg2.tslint@1.0.42
ms-vscode.csharp@1.17.1
ms-vscode.PowerShell@1.10.2
msjsdiag.debugger-for-chrome@4.11.1


### PSES version: 1.10.2.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27)
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Issue Description

While working on an enhancement to the Command Explorer, I noticed a number of command names showed up twice. I also noted that they didn't duplicate in pwsh at the terminal. It appears they are being duplicated when you have multiple versions of the same module (in my case I have versions 1.6.7 and 2.0.3 of PowerShellGet installed).

I ran the command Microsoft.PowerShell.Core\Get-Command -CommandType @("Function","Cmdlet","ExternalScript") | Microsoft.PowerShell.Utility\Select-Object -Property @("Name","ModuleName") | Microsoft.PowerShell.Utility\Sort-Object -Property Name and I don't see the double commands.

Expected Behaviour

When refreshing the Command Explorer, should return a single instance of each command.

Actual Behaviour

Getting duplicate commands:
image

Attached Logs

logs.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Command Explorer refresh entry point and reproduce the issue with multiple versions of PowerShellGet installed. Compare the returned commands with the provided Get-Command pipeline; done means refreshing the explorer shows only one instance of each command name.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.