vscode-powershell
vscode-powershell copied to clipboard
Debugger jumps into middle of comment-based help of current function instead of called function body
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all open and closed issues to ensure it has not already been reported.
- [X] I have read the troubleshooting guide.
- [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- [X] If this is a security issue, I have read the security issue reporting guidance.
Summary
Debugger jumps into middle of comment-based help of current function instead of called function body.
PowerShell Version
Name Value
---- -----
PSVersion 7.2.5
PSEdition Core
GitCommitId 7.2.5
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
1.69.2
3b889b090b5ad5793f524b5d1d39fda662b96a2a
x64
Extension Version
[email protected]
[email protected]
Steps to Reproduce
- Start debugging an module.
- When calling function in other module the debugger jumps initially into middle of comment-based help of current function instead of called function body.
It happens also in previous stable version of extension (v2022.6.3).
Visuals
Logs
When that happens, can you type list
in the extension terminal? See where PowerShell itself thinks we've hit a sequence point?
Oh, it is in the parameter block of the called function so in the correct place, just the view is not updated:
24: #>
25: [CmdletBinding()]
26: [OutputType([Management.Automation.PSCredential])]
27: param(
28: [ValidateNotNullOrEmpty()]
29:* [String]$UserName = [Environment]::UserName
30: )
31:
32: try {
33: #Get import key file and credential file paths based on user name
34: $files = Get-KBCredentialFilePath -UserName $UserName
35:
36: #Throw exception when import key file is not found
37: if (-not [IO.File]::Exists($files['KeyFile'])) {throw [IO.FileNotFoundException] ('Import key file not found: "{0}"' -f $files['KeyFile'])}
38:
39: #Throw exception when credential file is not found
Talked this over a bit in discord. Looks like we are setting cursor position but not moving to the next file. So either our call to switch to the file is failing or we're hitting a race where we set position and that's canceling the switch? Something like that. Either way definitely our bug.