Skip to content

Debug Session Clutters Terminal Command History #873

Closed
@mike-the-automator

Description

@mike-the-automator

System Details

  • Operating system name and version:
  • VS Code version:
  • PowerShell extension version:
  • Output from $PSVersionTable:


PS C:\Temp> code -v
1.13.0
376c52b955428d205459bea6619fc161fc8faacf
PS C:\Temp> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      3      2      0


PS C:\Temp> code --list-extensions --show-versions
ms-vscode.PowerShell@1.3.2
ms-vsts.team@1.118.2
PS C:\Temp> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.1198
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.1198
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with commands being inserted into the command history by a debugging session. The additional commands seem to be related to the debugging session. I have reproduced this issue with a simple .ps1 file containing a single variable assignment, with a breakpoint set on the line.

Repro.ps1:
$x=1

The entires I'm referring to are Ids 5-9 in the below transcript. The "Get-Variable" entries in the command history appear to be triggered by hovering the mouse over a variable in the editor window to view its value. I'm not sure what triggers the ones.

PS C:\Projects\SQLServerDBA\PowerShellModulesV2> c:\Temp\repro.ps1


PS C:\Temp> get-history

  Id CommandLine
  -- -----------
   1 get-module
   2 gci c:\temp\
   3 c:\Temp\repro.ps1


PS C:\Temp> c:\Temp\repro.ps1



Hit Line breakpoint on 'C:\Temp\repro.ps1:1'

[DBG]: [DBG]: PS C:\Temp>
PS C:\Temp> Get-history

  Id CommandLine
  -- -----------
   1 get-module
   2 gci c:\temp\
   3 c:\Temp\repro.ps1
   4 get-history
   5 @{ 'computerName' = $env:ComputerName; 'processId' = $PID; 'instanceId'...
   6 Get-Variable
   7 Get-Variable
   8 $global:__psEditorServices_CallStack = Get-PSCallStack; $global:__psEdi...
   9 Get-Variable
  10 c:\Temp\repro.ps1

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions