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

Debugger doesn't flush output reliably #138

Closed
rkeithhill opened this issue Feb 7, 2016 · 7 comments
Closed

Debugger doesn't flush output reliably #138

rkeithhill opened this issue Feb 7, 2016 · 7 comments
Labels
Issue-Bug A bug to squash.

Comments

@rkeithhill
Copy link
Collaborator

I've noticed while debugging that output from a line that has executed is not shown even though the script has hit a breakpoint on a subsequent line. I can step once and that is usually enough to get the output to appear. It would be nice though to have any pending output flushed on debugger stop.

@rkeithhill rkeithhill added the Issue-Bug A bug to squash. label Feb 7, 2016
@rkeithhill
Copy link
Collaborator Author

Wait a tic, I see you haven't checked that PR in yet. Hmm, I wonder why I'm seeing this behavior then.

@daviwil
Copy link
Contributor

daviwil commented Feb 7, 2016

Which script were you trying this with? I'll try to see if I can reproduce the behavior.

@rkeithhill
Copy link
Collaborator Author

Put this in a file and set a breakpoint on the second line:

$pwd
$pwd

The first $pwd doesn't display its output until you step over the breakpoint on the second one.

@daviwil
Copy link
Contributor

daviwil commented Feb 7, 2016

I see the same behavior in the ISE too, I wonder if the debugging engine is hitting the breakpoint so fast that the output doesn't even get flushed to the PSHost layer.

@daviwil
Copy link
Contributor

daviwil commented Feb 7, 2016

One thing I do notice though is that sometimes the debug adapter exits at the end of the script so fast that the final line of output might not get written (this is with a local build the buffering change). I'll need to make sure it gets flushed before exiting.

@daviwil
Copy link
Contributor

daviwil commented Feb 7, 2016

Yeah, this definitely comes from the PowerShell layer. I just tried flushing buffered output when a breakpoint gets hit and nothing got written out. I'll mark this as something to investigate for a future release.

@daviwil daviwil added this to the Backlog milestone Feb 7, 2016
@daviwil daviwil changed the title Debug output buffering should flush on debugger stop. Investigate lack of prior written output when debugger stops Feb 7, 2016
@daviwil daviwil changed the title Investigate lack of prior written output when debugger stops Debugger doesn't flush output reliably Sep 6, 2016
@demyte
Copy link

demyte commented Nov 4, 2016

@daviwil Any update on this one?

I am running in VSCode using Powershell extension v0.7.2 on Windows.

I have a simple script of:

Write-Host "Hello"
Write-Debug "Hello"
Write-Output "Hello"

Shows nothing in the Debug window nor in the PowerShell Output window.

If I execute the lines using F8, I get output in the PowershellOutput window for the first and third commands.

daviwil added a commit that referenced this issue Nov 29, 2016
This change fixes an issue where script output for very small scripts is
not being written out reliably before the debug adapter terminates.  The
fix is to add an extra output flush before sending the TerminatedEvent
back to the client.  This fix is temporary until we get the REPL
integration online.

Resolves #138.
Resolves PowerShell/vscode-powershell#284.
@daviwil daviwil modified the milestone: Backlog May 24, 2017
TylerLeonhardt pushed a commit to TylerLeonhardt/PowerShellEditorServices that referenced this issue Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants