Skip to content

Debugger throws error when launched before Editor Services finishes initializing #277

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
duffwv opened this issue Sep 6, 2016 · 9 comments
Labels
Issue-Bug A bug to squash.

Comments

@duffwv
Copy link

duffwv commented Sep 6, 2016

The debugger doesn't seem to work. Either the bar on the bottom of vscode turns from blue to orange momentarily, and the debugger stops. No variable information, ignores breakpoints, no output to the console. Or I get the error: "Debug adapter process has terminated unexpectedly"

System Details

  • Windows 8.1
  • VS Code version: 1.40
  • PowerShell extension version: 0.7.2
Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.34209
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Attached Logs

Attached logs first with anti-virus and firewall on as per company settings. Then I deleted the logs, turned off the antivirus and firewall and ran again and attached those logs.

logs.zip

@duffwv
Copy link
Author

duffwv commented Sep 6, 2016

Although, I still git the error I mentioned occasionally. It seems the times the bar just goes from blue to orange to blue again the debugger is running.

It appears there are two things that I didn't expect.

  1. It ignores breakpoints on blank lines
  2. It never displays the last line in the console, the debugger stops and clears at the end of script execution.

So,

  1. I can't set a breakpoint on a blank line, I get it, just unexpected to me.
  2. But to actually view the final state of the script I have to put a pause or write-{something}, at the
    bottom and set a breakpoint on that? What am I missing?

@daviwil
Copy link
Contributor

daviwil commented Sep 6, 2016

Hey @duffwv, I checked out your logs, can you turn on verbose logging and capture logs again?

Regarding breakpoints on an empty line, this is not allowed by PowerShell. You can't set breakpoints on an empty line in the PowerShell ISE either. The output issue you reported is a known issue which will be addressed in a future update. Since it seems to be happening for a lot of people recently I'm going to raise it's priority and try to get it fixed in the next release.

@reduckted
Copy link

Similar issues here.

OS Name: Microsoft Windows 10 Pro (10.0.10586 Build 10586)
VS Code: 1.4.0 (Commit 6276dcb0...)
PowerShell Extension: 0.7.2
PowerShell: 5.0.10586.494

I've had the "Debug adapter process has terminated unexpectedly" error once or twice. However, more annoyingly, nothing is written to the debug console unless the code hits a breakpoint.

I'm using this simple test script:

Write-Output "Foo"

$foo = 4

Write-Output $foo

$foo = 2

If I run it without any breakpoints, then there is no output. If I put a breakpoint on $foo = 4, then the only output I get is "Foo". If I put a breakpoint on $foo = 2, then I get output of "Foo" and "4".

Here are the logs from three separate runs:

  1. DebuggerTerminatedUnexpectedly.zip: This is when I received the "Debug adapter process has terminated unexpectedly" message.
  2. NoOutput.zip: I pressed F5 without any breakpoints.
  3. WithBreakpoint.zip: I pressed F5 with a breakpoint on $foo = 4.

@duffwv
Copy link
Author

duffwv commented Sep 7, 2016

Sorry I missed the verbose thing. After eliminating my confusion by the breakpoint and final output things. I noticed some consistency regarding the error. It seems to occur the first time I try to debug, afterwards it works. I haven't used it long enough to see if it occurs over time. I've included the logs with and without A/V and firewall on as the error occured the first time and then I quit. I've also included the logs after running it three times, first time it errors and the second and third it works.

I dug thru the settings and noticed: "powershell.developer.editorServicesWaitForDebugger": false and the name seemed somewhat relevant, so I set it to true and restarted vscode. It didn't work, but I've also attached the logs with three runs with it set to true.

logsverbose.zip

@duffwv
Copy link
Author

duffwv commented Sep 7, 2016

After that it occured to me to try to open vscode and wait. If I open vscode and immediately start to debug it fails the first time. I opened vscode and waited a full 30 seconds and ran it and it worked. Seems to have a significant delay between opening vscode and the debugger service on my system.

@daviwil
Copy link
Contributor

daviwil commented Sep 7, 2016

Thanks a lot for putting those together! I'll take a look and let you know what I find. And thank you too, @thirdwaffle!

@daviwil
Copy link
Contributor

daviwil commented Sep 7, 2016

@duffwv ahhhh yes. this is definitely a problem, there is an initial delay for the language service to start up. I've just created a new issue (#281) to add some progress indicator to make it clear when the language/debug server is still in progress of starting up.

@daviwil daviwil added the Issue-Bug A bug to squash. label Sep 8, 2016
@daviwil daviwil added this to the 0.7.3 milestone Sep 8, 2016
@daviwil daviwil changed the title Debugger doesn't seem to work, crashes? Debugger throws error when launched before Editor Services finishes initializing Sep 8, 2016
@daviwil
Copy link
Contributor

daviwil commented Sep 12, 2016

Still waiting to hear back from the VS Code team for a way to display a specific error from the debug adapter at startup (microsoft/vscode-debugadapter-node#57). I might end up fixing this for 0.8.0 along with related issue #281.

@daviwil daviwil modified the milestones: 0.7.3, 0.8.0, Backlog Nov 29, 2016
@rjmholt
Copy link
Contributor

rjmholt commented Mar 17, 2020

Closing as defunct

@rjmholt rjmholt closed this as completed Mar 17, 2020
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

4 participants