Unregister-EditorCommand doesn't remove command from list
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- powershell, typescript
- 領域
- devtools
調査の方向性
まず「register、list、unregister、list」のシーケンスを再現し、次に ExtensionService.cs の146行目と InvokeExtensionCommandHandler.cs の27行目で発生している失敗を起点に、コマンドリストの処理を追跡します。未登録のコマンドが Additional Commands に表示されなくなり、それを呼び出しても古いエントリによる例外が発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
When calling Unregister-EditorCommand or $psEditor.UnregisterCommand(), the command remains in the Additional Commands list, leading to duplicate entries when my profile module is re-loaded. When trying to invoke the command afterwards, an exception is thrown, so the command is being unregistered, but it remains on the list.
PowerShell Version
Name Value
---- -----
PSVersion 7.5.3
PSEdition Core
GitCommitId 7.5.3
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Name : Visual Studio Code Host
Version : 2025.3.1
InstanceId : db3b07b7-3b3b-40bb-8b54-c57ae4548a21
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.104.1
0f0d87fa9e96c856c5212fc86db137ac0d783365
x64
Extension Version
ironmansoftware.powershellprotools@2024.12.0
martinfliegner.dark-powershell-theme@1.0.0
ms-vscode.powershell@2025.3.1
tylerleonhardt.vscode-inline-values-powershell@0.0.7
xkoloblicin.powershell-ise-dark@1.0.1
(note: PowerShell Pro Tools is disabled in my current workspace)
Steps to Reproduce
- Register any simple command, like `Register-EditorCommand -Name MyCommand -DisplayName "Test Command" -ScriptBlock {$psEditor.Window.ShowInformationMessage("I came from Register-EditorCommand.")}
- View registered commands with
Shift+Alt+Sor "PowerShell: Show Additional Commands from PowerShell Modules" to ensure the command is registered - Invoke the command to verify it works
- Unregister the command with
Unregister-EditorCommand -Name MyCommandor$psEditor.UnregisterCommand("MyCommand") - View registered commands again to find if the command remains
Visuals
Logs
For whatever reason, even setting "powershell.developer.editorServicesLogLevel": "Trace" and "powershell.trace.server": "verbose", the PowerShell output log looks about the same as when it's set to "Information", despite the Integrated Terminal showing trace information (e.g. "DEBUG: [Trace] Logging started", etc.). Nothing showed up about registering commands or loading modules.
The only thing I could find after unregistering the command and executing it from the list is from the Extension Host log:
2025-09-18 15:29:28.824 [error] Error: Internal Error - System.Collections.Generic.KeyNotFoundException: Editor command not found: 'ConvertComment3Center'
at Microsoft.PowerShell.EditorServices.Services.Extension.ExtensionService.InvokeCommandAsync(String commandName, EditorContext editorContext, CancellationToken cancellationToken) in C:\__w\1\s\src\PowerShellEditorServices\Services\Extension\ExtensionService.cs:line 146
at Microsoft.PowerShell.EditorServices.Services.Extension.InvokeExtensionCommandHandler.Handle(InvokeExtensionCommandParams request, CancellationToken cancellationToken) in C:\__w\1\s\src\PowerShellEditorServices\Services\Extension\Handlers\InvokeExtensionCommandHandler.cs:line 27
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.SemanticTokensDeltaPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.LanguageServer.Server.Pipelines.ResolveCommandPipeline`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.<RouteRequest>g__InnerRoute|7_0(IServiceScopeFactory serviceScopeFactory, Request request, TDescriptor descriptor, Object params, CancellationToken token, ILogger logger)
at OmniSharp.Extensions.JsonRpc.RequestRouterBase`1.RouteRequest(IRequestDescriptor`1 descriptors, Request request, CancellationToken token)
at OmniSharp.Extensions.JsonRpc.DefaultRequestInvoker.<>c__DisplayClass10_0.<<RouteRequest>b__5>d.MoveNext()
at handleResponse (c:\Users\e.dunhjo\.vscode\extensions\ms-vscode.powershell-2025.3.1\dist\extension.js:30293:40)
at handleMessage (c:\Users\e.dunhjo\.vscode\extensions\ms-vscode.powershell-2025.3.1\dist\extension.js:30103:11)
at processMessageQueue (c:\Users\e.dunhjo\.vscode\extensions\ms-vscode.powershell-2025.3.1\dist\extension.js:30118:13)
at Immediate.<anonymous> (c:\Users\e.dunhjo\.vscode\extensions\ms-vscode.powershell-2025.3.1\dist\extension.js:30094:11)
at processImmediate (node:internal/timers:485:21)
at process.callbackTrampoline (node:internal/async_hooks:130:17) PowerShell.ShowAdditionalCommands {"value":"ms-vscode.powershell","_lower":"ms-vscode.powershell"}
- 主要言語
- TypeScript
- スター
- 1.9k
- フォーク
- 548
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PowerShell/vscode-powershell のほかの issue
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
PowerShell/vscode-powershell#5599 · コメント 3 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
PowerShell/vscode-powershell#5592 · コメント 2 件 · リアクション 1 件 ·
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
PowerShell/vscode-powershell#5583 · コメント 1 件 ·
-
powershell.scriptAnalysis.settingsPath (Description): Warning Message Should Provide A Workaround オープンArea-Code Formatting Issue-Enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
PowerShell/vscode-powershell#4653 · コメント 3 件 · リアクション 4 件 ·
-
nothing オープンIssue-Bug Needs: Triage
難易度 5/5 1週間以上 初心者へのやさしさ 5/100
PowerShell/vscode-powershell#5603 · リアクション 1 件 ·
PowerShell/vscode-powershell の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
area:tools bug good first issue help wanted priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
TaewoooPark/Motifcode#14 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
newrelic-experimental/preflight#793 · コメント 1 件 ·
-
bug 🐞
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
BasedHardware/omi#15320 ·