Skip to content

Debugger jumps into middle of comment-based help of current function instead of called function body #4103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 tasks done
kborowinski opened this issue Aug 3, 2022 · 3 comments · Fixed by PowerShell/PowerShellEditorServices#1898
Assignees
Labels

Comments

@kborowinski
Copy link

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

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

Steps to Reproduce

  1. Start debugging an module.
  2. 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

Animation

Logs

20220803T165817.zip

@kborowinski kborowinski added the Issue-Bug A bug to squash. label Aug 3, 2022
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 3, 2022
@SeeminglyScience
Copy link
Collaborator

SeeminglyScience commented Aug 3, 2022

When that happens, can you type list in the extension terminal? See where PowerShell itself thinks we've hit a sequence point?

@kborowinski
Copy link
Author

kborowinski commented Aug 3, 2022

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

@SeeminglyScience
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
3 participants