Skip to content
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

Can't debug when using PowerShell 7.4 #4668

Closed
6 tasks done
PrzemyslawKlys opened this issue Jul 19, 2023 · 11 comments · Fixed by PowerShell/PowerShell#20046
Closed
6 tasks done

Can't debug when using PowerShell 7.4 #4668

PrzemyslawKlys opened this issue Jul 19, 2023 · 11 comments · Fixed by PowerShell/PowerShell#20046
Assignees
Labels

Comments

@PrzemyslawKlys
Copy link
Contributor

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

It seems that VSCode doesn't stop on breakpoints when debugging in PS 7.4

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.4
PSEdition                      Core
GitCommitId                    7.4.0-preview.4
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.80.1
x64

Extension Version

ms-vscode.powershell@2023.6.0

Steps to Reproduce

  1. Create empty file
  2. Add some code

Write-Host "Test 1"

Write-Host "Test 2"
  1. Set breakpoint

  2. Press F5

  3. Notice it doesn't stop

Visuals

Debugging not working

Logs

No response

@PrzemyslawKlys PrzemyslawKlys added the Issue-Bug A bug to squash. label Jul 19, 2023
@sba923
Copy link

sba923 commented Jul 24, 2023

Confirmed here with PowerShell 7.4.0-preview.4 on Windows 10, with v2023.6.0 of the extension.

@andyleejordan
Copy link
Member

Thanks, am looking at this with high priority.

@andyleejordan
Copy link
Member

Yup, reproduces locally. Going to start testing versions backwards to see when it first breaks.

@andyleejordan
Copy link
Member

Whelp, works in preview.3 and not preview.4 so at least that's pretty narrow!

@andyleejordan
Copy link
Member

andyleejordan commented Jul 26, 2023

"Narrow" as I look at the diff...my current guess is from PowerShell/PowerShell#14953 but I need to figure out exactly what.

@fflaten
Copy link
Contributor

fflaten commented Jul 29, 2023

I can only reproduce on Windows, not Ubuntu. What about MacOS?

@fflaten
Copy link
Contributor

fflaten commented Jul 29, 2023

Looks like a perfect storm caused by two bugs:

# breakpoint set in vscode
> Get-PSBreakpoint | % Script 
c:\Users\Frode\Desktop\Demo\HelperModule.psm1

# reference - notice driveletter
> dir .\HelperModule.psm1 | % fullname
C:\Users\Frode\Desktop\Demo\HelperModule.psm1

@andyleejordan
Copy link
Member

@fflaten I can at least say that the server is registering with that driver letter being lowercase because it's literally coming across the wire that way (that is, in the SetBreakpointsArguments request of the SetBreakpointsResponse handler with OmniSharp). Not sure if it's something O# is doing, or if it's coming from the client like that. If I can fix that, theoretically this issue is "solved" (though I still think we should fix the behavioral regression in PowerShell until we do it intentionally).

@andyleejordan
Copy link
Member

Uhh actually, more info! I see the same behavior in the logs of the C# extension (also built on top of O#) where the drive letter is being lower-cased for every LSP request with a path. So it's definitely an O# thing. Grr.

@fflaten
Copy link
Contributor

fflaten commented Aug 1, 2023

Maybe intentional to align with VSCode API? Uri.fspath also lowercases it (source)

fsPath: string

The string representing the corresponding file system path of this Uri.

Will handle UNC paths and normalize windows drive letters to lower-case. Also uses the platform specific path separator.

@andyleejordan
Copy link
Member

@fflaten yup, that was exactly it! Ha, just saw this and figured out the same thing from a different investigation.

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