Skip to content

Debug adapter process has terminated unexpectedly #243

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
GHRoss opened this issue Aug 18, 2016 · 42 comments
Closed

Debug adapter process has terminated unexpectedly #243

GHRoss opened this issue Aug 18, 2016 · 42 comments
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@GHRoss
Copy link

GHRoss commented Aug 18, 2016

With the latest version of VS Code (1.4.0), and the latest version of PowerShell for VS Code (0.7.0) running on Windows 10 version 1607 OS Build 14393.51, whenever I run a PowerShell script, I get a 'Debug adapter process has terminated unexpectedly'.

This is what I see in developer tools...

Ctrl+Alt+ keybindings should not be used by default under Windows. Offender: 40995 for PowerShell.ExpandAlias [Extension Host] Spell and Grammar checker active... [Extension Host] Default Settings [Extension Host] Code Actons Registering for: markdown [Extension Host] Code Actons Registering for: plaintext [Extension Host] powershell.exe started, pid: 8264, exe: C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe [Extension Host] Socket connected! Debug adapter process has terminated unexpectedly Debug adapter process has terminated unexpectedly: Error: Debug adapter process has terminated unexpectedly at Object.C [as create] (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:34:19570) at file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:105:21677 at Object.m [as _notify] (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:8153) at Object.B.enter (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:11658) at i.Class.define._run (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:12979) at i.Class.define._chainedError (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:12338) at i (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:10161) at i.Class.define.then (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:13788) at Object.P.enter (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:10230) at i.Class.define._run (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:12979) at i.Class.define._setCompleteValue (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:30:12673)

This is my launch.json which hasn't been changed since I updated PowerShell for VS Code...

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "PowerShell",
            "type": "PowerShell",
            "request": "launch",
            "program": "${file}",
            "args": [],
            "cwd": "${file}"
        },
        {
            "name": "PowerShell x86",
            "type": "PowerShell x86",
            "request": "launch",
            "program": "${file}",
            "args": [],
            "cwd": "${file}"
        }
    ]
}

vscodedebug

@daviwil
Copy link
Contributor

daviwil commented Aug 18, 2016

Hey GHRoss, thanks for the report. Can you zip up the contents of the following folder and send it to me?

$HOME\.vscode\extensions\ms-vscode.PowerShell-0.7.0\logs

@GHRoss
Copy link
Author

GHRoss commented Aug 18, 2016

If there's a better way to send these to you, please let me know.

logs.zip

@daviwil
Copy link
Contributor

daviwil commented Aug 18, 2016

Strange, I see no errors in the log output... When you run your code in the debugger, are you selecting the 'PowerShell' or 'PowerShell x86" configuration?

@jrotello
Copy link

jrotello commented Aug 19, 2016

I'm running into the same issue. The only message that stands out to me is...

Connecting to port: 10474
Connected to socket!

Socket closed, shutting down.Socket connect ERROR: Error: This socket has been ended by the other party
Socket connect ERROR: Error: This socket has been ended by the other party

logs.zip

Edit: Adding PowerShell version...

Name                           Value
----                           -----
PSVersion                      5.1.14393.82
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.82
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

@GHRoss
Copy link
Author

GHRoss commented Aug 19, 2016

PowerShell. If I try using PowerShell x86, I get the following...

Configured debug type 'PowerShell x86' is not supported.'

@reduckted
Copy link

Same problem here.

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

On the first attempt to start debugging, this gets written to DebugAdapterClient.log:

Connecting to port: 28452
Connected to socket!

Socket closed, shutting down.Socket connect ERROR: Error: This socket has been ended by the other party

On the second attempt, this is written to the log:

Connecting to port: 28452
Connected to socket!

Socket closed, shutting down.

This is the contents of PowerShell.log:

powershell.exe started --
    pid: 2816
    exe: C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe
    bundledModulesPath: C:\Users\me\.vscode\extensions\ms-vscode.PowerShell-0.7.0\modules
    args: C:\Users\me\.vscode\extensions\ms-vscode.PowerShell-0.7.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion "0.7.0" -HostName "Visual Studio Code Host" -HostProfileId "Microsoft.VSCode" -HostVersion "0.7.0" -BundledModulesPath "C:\Users\me\.vscode\extensions\ms-vscode.PowerShell-0.7.0\modules" -LogLevel "Normal" -LogPath "C:\Users\me\.vscode\extensions\ms-vscode.PowerShell-0.7.0\logs\1471839044-EditorServices.log" 

OUTPUT: {"debugServicePort":28452,"status":"started","channel":"tcp","languageServicePort":18148}
Connecting to port: 18148

Also, it's worth noting that if I start a brand new project, add a PowerShell file and press F5, the launch.json file that is automatically created only contains a "PowerShell" configuration - there's no "PowerShell x86" configuration. I seem to recall that it used to create two configurations, but maybe I'm not remembering things correctly.

@reduckted
Copy link

reduckted commented Aug 22, 2016

FWIW I rolled back to version 0.6.0 of the extension and debugging works fine.

P.S. As I thought, the default launch.json under v.0.6.0 does create two configurations - "PowerShell" and "PowerShell x86".

@daviwil
Copy link
Contributor

daviwil commented Aug 25, 2016

I released 0.7.1 yesterday, has that improved anyone's experience? On another issue (#64), @FaffeF has reported that debugging works more often for him now but still fails intermittently:

Updated the extension to 0.7.1 this morning, and suddenly debugging worked!

  • Then it worked again!
  • Then it didn't work (same error, showing me launch.json)
  • Then it worked a lot across different files.
  • Then it failed a lot.
  • After a restart debugging works again...

@jrotello
Copy link

I'm having the same experience as @FaffeF. It seems to work the first time I debug when opening VS Code, but subsequent debugging fails until I close VS Code.

@MarlonRodriguez
Copy link

Still a problem on 7.1

@pcgeek86
Copy link
Contributor

I'm getting this error message a lot. @daviwil

Debug adapter process has terminated unexpectedly

image

@daviwil
Copy link
Contributor

daviwil commented Aug 29, 2016

Trevor, can you send me your logs? Zip up this folder and e-mail it to me:

$HOME\.vscode\extensions\ms-vscode.PowerShell-0.7.1\logs

@pcgeek86
Copy link
Contributor

@daviwil Sent them over -- can you verify the link works?

@daviwil
Copy link
Contributor

daviwil commented Aug 29, 2016

@pcgeek86 got it, thanks man! I'll take a look at these in a little while.

@kolinchang
Copy link

Hi guys, we are having the same problem. We have downgraded to 0.6.1 for now and seems to run fine.

@bullying520
Copy link

I downgraded the extension to 0.6.1 and it fixed my issue.
Here are the steps if anyone is interested:

  1. download the 0.6.1 from: https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/PowerShell/0.6.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
  2. Rename Microsoft.VisualStudio.Services.VSIXPackage to Microsoft.VisualStudio.Services.VSIX
  3. uninstall the current 0.7.1
  4. open a powershell console
  5. locate to your vs code installation folder
  6. run "code "
  7. restart vs code

@daviwil
Copy link
Contributor

daviwil commented Sep 1, 2016

I just looked over a bunch of logs and I'm seeing some patterns in the error messages. Looks like the connections to the debug service are being rejected at times even though the Editor Services logs say that the socket was initialized successfully.

I'll try to reproduce and fix the issue today. If I can't immediately get a fix I'll still try to make some tweaks to the debugger client so that it's more resilient when a connection can't be made immediately. I'll ship an update in the next day or two after I've made some progress!

@jackfruh
Copy link

jackfruh commented Sep 1, 2016

I just want to say that Powershell on osx might be the best thing to happen since sliced bread.

@daviwil
Copy link
Contributor

daviwil commented Sep 1, 2016

I think I fixed the problem! Filed an issue on the PowerShellEditorServices repo to track it: PowerShell/PowerShellEditorServices#284

New release with the fix within 24 hours! I'll close the bug after everyone has confirmed that the problem is gone.

daviwil added a commit to PowerShell/PowerShellEditorServices that referenced this issue Sep 2, 2016
This change fixes an issue in PowerShellContext.AbortException which
causes it to throw a NullReferenceException when called after the session
has already been aborted.  This issue manifests sometimes when the
debug adapter finishes execution normally or when it terminates due to a
script parsing error.  It was initially reported in the following two
issues for the PowerShell VS Code extension:

PowerShell/vscode-powershell#243
PowerShell/vscode-powershell#273

The fix is to check whether the PowerShellContext.SessionState is Aborted
or Disposed before proceeding with the abort.
@daviwil daviwil added the Issue-Bug A bug to squash. label Sep 2, 2016
@daviwil daviwil added this to the 0.7.2 milestone Sep 2, 2016
@daviwil daviwil mentioned this issue Sep 2, 2016
@christianhv
Copy link

Hello,
I do not think that this issue is solved. I have to downgrade the extension in order to have the debug option. Running now version 0.6.1. Greets

@daviwil
Copy link
Contributor

daviwil commented Sep 7, 2016

Hi @christianhv, could you capture logs using version 0.7.2 so that I can see what might be going wrong? Full instructions can be found here:

https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

@pcgeek86
Copy link
Contributor

pcgeek86 commented Sep 7, 2016

@daviwil FYI I just wanted to let you know that I'm currently not experiencing the bug on 0.7.2 with VSCode 1.4.0. Thanks for fixing it! Hopefully Christian's issue is an easy one to solve.

@christianhv
Copy link

Hello,

I could not upload the zip file. You can find it as attachment in this email. 

Regards,
Christian

On Sep 07, 2016, at 03:59 PM, David Wilson [email protected] wrote:

Hi @christianhv, could you capture logs using version 0.7.2 so that I can see what might be going wrong? Full instructions can be found here:
https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@daviwil
Copy link
Contributor

daviwil commented Sep 7, 2016

Hi Christian, unfortunately GitHub does not include e-mail attachments when you reply to issue mails. Can you email your zip file to daviwil [at] microsoft.com? Thanks!

@christianhv
Copy link

I already did that. Thanks

Kind regards,
Christian.

On Sep 7, 2016, 7:05 PM +0200, David Wilson [email protected], wrote:

Hi Christian, unfortunately GitHub does not include e-mail attachments when you reply to issue mails. Can you email your zip file to daviwil [at] microsoft.com? Thanks!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (#243 (comment)), or mute the thread (https://github.com/notifications/unsubscribe-auth/AA6EhdgEAxFZZ7aaJDdcNkazZmcjHm_mks5qnu5HgaJpZM4JnwiU).

@daviwil
Copy link
Contributor

daviwil commented Sep 8, 2016

Christian, I haven't received the logs in a separate e-mail (not in my junk mail either). If you sent the logs to the e-mail address you are replying to now, that goes to GitHub, not my e-mail address. Can you send a new e-mail directly to daviwil [at] microsoft.com with the logs? If you've done that already, I apologize, but I never received it.

@GHRoss
Copy link
Author

GHRoss commented Sep 10, 2016

Christian, are you using Windows 7?

I am still experiencing the same issues on my personal Windows 7 laptop (didn't upgrade, bootcamp Macbook Pro drivers for my generation don't exist for Windows 10 👎 ) BUT my work PC is Windows 10 and seems to be working fine with the latest update.

@daviwil
Copy link
Contributor

daviwil commented Sep 10, 2016

@GHRoss great question, I'll check it out on Windows 7 on Monday. Too many OS versions and platforms to keep up with now :)

@GHRoss
Copy link
Author

GHRoss commented Sep 10, 2016

I'm now having problems with the latest version of VS Code and the PowerShell extention!

I get no output in the debugger now.

Tested on Windows 10 and Windows 7. Script gives expected output in ISE.

@daviwil
Copy link
Contributor

daviwil commented Sep 10, 2016

What happens if you set a breakpoint somewhere near the end of the script, does it get written out when you run again? If so, could be another manifestation of issue #284.

@GHRoss
Copy link
Author

GHRoss commented Sep 11, 2016 via email

@ConstantineK
Copy link

I had a similar error where write-output is not shown, after several tests I was able to trigger the "Debug adapter process has terminated unexpectedly" in VS Code: 1.5.1/Windows 8 version 6.3.9600 but the issue is intermittent.

I reduced my test down to a document which contains two lines:
"test"
write-output "test"

If I add a breakpoint or throw an error via typing invalid commands I will see the output returned to the Debug Console.

Should I be commenting on #284 even though it is closed?

@bughit
Copy link

bughit commented Sep 12, 2016

@bullying520

download the 0.6.1 from: https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/PowerShell/0.6.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
Rename Microsoft.VisualStudio.Services.VSIXPackage to Microsoft.VisualStudio.Services.VSIX
uninstall the current 0.7.1
open a powershell console
locate to your vs code installation folder
run "code "
restart vs code

the run line should be "code Microsoft.VisualStudio.Services.VSIX"

@daviwil
Copy link
Contributor

daviwil commented Sep 12, 2016

Hey @ConstantineK, #284 is open, you should subscribe to that issue to be notified when the issue is fixed.

@christianhv
Copy link

Hello,

Sorry for my late reply. I did send the log files. I will check again but I think already did. Yes, indeed. I am using windows 7.

Regards.

@tegaaa
Copy link

tegaaa commented Dec 22, 2016

So i'm on windows 7 with vscode 1.8.1 (latest as of today) and powershell ext 0.8.0 and I have this issue all the time. It works with simple powershell but as soon as I call other stuff and the PS becomes complex it fails then I get this error for 5 or 6 runs (have to stop VSC and restart it) until it starts working again. I have nothing in the log stating errors all is clean (start listening etc. no errors)... Was working ok with old extension IIRC. Will try and revert and let you know.

@daviwil
Copy link
Contributor

daviwil commented Dec 22, 2016

@tegaaa Have you tried turning on Verbose logging to see if there's any extra information there? You should send logs regardless of whether anything looks obviously like an error:

https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

@tegaaa
Copy link

tegaaa commented Dec 22, 2016 via email

@tegaaa
Copy link

tegaaa commented Dec 22, 2016

so here it is (the log). I can't debug at all now... I love Code and this extension is a god save compared to ISE. I'm sure you'll figure it out.
1482438108-b667273e-6b41-4064-a3fe-3666882634341482438106635.zip

@dgee2
Copy link

dgee2 commented Dec 30, 2016

I've just hit the same issue on VSCode 1.8.1 and PowerShell extension 0.8.0.

I seem to have solved this by uninstalling the PowerShell extension, reloading VSCode and reinstalling the extension. I can now debug PowerShell again.

Posting here as it's the top result on Google when searching for this.

@angel120
Copy link

angel120 commented Jan 12, 2017

Running VS Code 1.8.1, PowerShell extension 0.8.0:

Steps taken:

  • Started debugging a PS script at 12:13 PM
  • Hit a breakpoint, checked some values
  • Pressed continue
  • Debugger showed the "pause" button (instead of the "play" button), but the script stopped running (verified that it stopped running via console output, no other breakpoints were hit)

Here's my EditorServices.log:
http://pastebin.com/eCC2Ymf4

The only way I can get past this is by killing the powershell.exe process in Task Manager, then letting VSC restart the extension.

Also, when this issue happens, the poweshell.exe process is consuming a large amount of RAM - I've seen it as high as 150 MB.

@kniz
Copy link

kniz commented Aug 6, 2017

I downloaded "cppcheck" plugin, but it coudn't be installed on my VSCode properly.
And above issues had been reproduced.

In my case, uninstalling "cppcheck" solved my issue.

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