Skip to content

Different Preview Behavior for debugging #2289

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
PrzemyslawKlys opened this issue Nov 6, 2019 · 7 comments
Closed

Different Preview Behavior for debugging #2289

PrzemyslawKlys opened this issue Nov 6, 2019 · 7 comments

Comments

@PrzemyslawKlys
Copy link
Contributor

Issue Description

I am experiencing a problem with... debugging. I set a breakpoint as I would normally do. The code stops.

image

I see what I want to see - I press SHIFT+F5 to stop PowerShell and fix the issues.

In production the code is stopped, and nothing more is happening. In Preview the data that is currently in place seems to flow to terminal.

Normally you should be able to reproduce it with something similar to:

for ($i = 0; $i -lt 10; $i++) {
    'test'
}

After it hits breakpoint, when you do Shift + F5 it will throw everything else into the

image

But while working on this easy to use example I seem to hit #2175 issue all the time. After I run the code, nothing happens (F5 stops working). And after I restart PowerShell

image

And can't run any code either. I have to close VSCode to be able to work again.. however finally I was able to run different code, and again try to build a working example:

$Testor = for ($i = 0; $i -lt 10; $i++) {
    $Tes2 = for ($i = 0; $i -lt 10; $i++) {
        'test'
    }
    $Tes2
    'test'

}
$Testor

image

It will display all tests from Tes2.

But I can pretty much catch #2175 90% of the time using:

for ($i = 0; $i -lt 10; $i++) {
    'test'
}

Sorry for mixing up two problems, but it just came while I was trying to reproduce so maybe related.

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17763
VSCode 1.39.2
PowerShell Extension Version 2019.11.1

PowerShell Information

Name Value
PSVersion 5.1.17763.771
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.17763.771
BuildVersion 10.0.17763.771
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
beautify HookyQR 1.5.0
gitlens eamodio 10.1.2
material-icon-theme PKief 3.9.1
open-in-browser techer 2.0.0
powershell-preview ms-vscode 2019.11.1
theme-monokai-pro-vscode monokai 1.1.14
vscode-tldr bmuskalla 1.0.0
vscode-wakatime WakaTime 2.2.1
@rjmholt
Copy link
Contributor

rjmholt commented Dec 4, 2019

I wonder if this is a semantic issue for us. In most languages, leaving the debugger means "detach the debugger and allow the program to continue", but in PowerShell I think the norm is "end execution of the program I'm debugging". If that's the case, the solution is to get the script to terminate immediately in the detach handler.

@PrzemyslawKlys
Copy link
Contributor Author

To be honest with the way PowerShell behaves I'm not sure leaving it as it is a good idea. Because if I want to continue I just remove breakpoints and it will continue. If I want to stop, it means STOP.

The behavior I'm referring to is that you don't need to assign variables and it goes up. In case of my HTML module when I stop debugging I get full HTML 50 pages long thrown into a console (because it doesn't just continue to run saving to file and all) but throws everything out to console.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Dec 4, 2019
@rjmholt
Copy link
Contributor

rjmholt commented Dec 4, 2019

Because if I want to continue I just remove breakpoints and it will continue. If I want to stop, it means STOP.

Indeed, that's what I meant above. Although other languages treat this like that, I think in our case the expectation is for script execution to stop immediately.

@rjmholt rjmholt removed the Needs: Maintainer Attention Maintainer attention needed! label Dec 4, 2019
@TylerLeonhardt
Copy link
Member

I think wrt other languages, a decent amount follow this model:

launch requests will give you the ability to STOP the code that's running (spin down a web server, stop a script from continuing, etc) where attach requests typically just detach from the attached process but leave it running.

@rjmholt
Copy link
Contributor

rjmholt commented Dec 4, 2019

launch requests will give you the ability to STOP the code that's running (spin down a web server, stop a script from continuing, etc) where attach requests typically just detach from the attached process but leave it running.

That makes sense to me

@andyleejordan
Copy link
Member

Ok @PrzemyslawKlys I'm assuming this one was closed as irrelevant today lol

@PrzemyslawKlys
Copy link
Contributor Author

Yes, it no longer acts like that. So I closed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants