PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.71k stars 490 forks source link

ms-vscode.powershell-1.6.0 Debug Adapter process has terminated unexpectedly #1280

Closed ebmarquez closed 6 years ago

ebmarquez commented 6 years ago

System Details

code -v
1.22.2
3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
x64
$pseditor.EditorServicesVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
1      6      0      0
code --list-extensions --show-versions
ms-vscode.PowerShell@1.6.0
$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.251
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.251
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Install VS Code Install Powershell module. Open powershell script. Click on Debug Setup Launch with paths to the input variables for the script. Click on Debug. Get a popup reporting Debugger failed.

Logs

Vscode Logs: logs.zip

image

ebmarquez commented 6 years ago
4/20/2018 11:32:37 AM [NORMAL] - powershell.exe started, pid: 13716
4/20/2018 11:32:38 AM [NORMAL] - Language server started.
4/20/2018 11:32:39 AM [NORMAL] - {"debugServicePort":27718,"status":"started","channel":"tcp","languageServicePort":21038}
4/20/2018 11:32:39 AM [NORMAL] - Connecting to language service on port 21038...
4/20/2018 11:32:39 AM [NORMAL] - Language service connected.
4/20/2018 11:35:28 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
4/20/2018 11:35:58 AM [NORMAL] - Shutting down language client...
4/20/2018 11:35:58 AM [NORMAL] - Language server starting --
4/20/2018 11:35:58 AM [NORMAL] -     exe: C:\WINDOWS\SysWow64\WindowsPowerShell\v1.0\powershell.exe
4/20/2018 11:35:58 AM [NORMAL] -     args: C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.6.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\logs\1524249358-c67e5e42-0cc4-4829-8c10-625edae45d701524248223012\EditorServices.log' -SessionDetailsPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\sessions\PSES-VSCode-17868-128752' -FeatureFlags @()
4/20/2018 11:35:58 AM [NORMAL] - powershell.exe started, pid: 7636
4/20/2018 11:36:00 AM [NORMAL] - Language server started.
4/20/2018 11:36:00 AM [NORMAL] - {"debugServicePort":21493,"status":"started","channel":"tcp","languageServicePort":10735}
4/20/2018 11:36:00 AM [NORMAL] - Connecting to language service on port 10735...
4/20/2018 11:36:00 AM [NORMAL] - Language service connected.
4/20/2018 11:38:50 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
4/20/2018 11:39:10 AM [NORMAL] - Shutting down language client...
4/20/2018 11:39:10 AM [NORMAL] - Language server starting --
4/20/2018 11:39:10 AM [NORMAL] -     exe: C:\WINDOWS\SysWow64\WindowsPowerShell\v1.0\powershell.exe
4/20/2018 11:39:10 AM [NORMAL] -     args: C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.6.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\logs\1524249550-c67e5e42-0cc4-4829-8c10-625edae45d701524248223012\EditorServices.log' -SessionDetailsPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\sessions\PSES-VSCode-17868-447203' -FeatureFlags @()
4/20/2018 11:39:10 AM [NORMAL] - powershell.exe started, pid: 15452
4/20/2018 11:39:12 AM [NORMAL] - Language server started.
4/20/2018 11:39:12 AM [NORMAL] - {"debugServicePort":16425,"status":"started","channel":"tcp","languageServicePort":17181}
4/20/2018 11:39:12 AM [NORMAL] - Connecting to language service on port 17181...
4/20/2018 11:39:12 AM [NORMAL] - Language service connected.
4/20/2018 11:39:20 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
4/20/2018 11:39:24 AM [NORMAL] - Shutting down language client...
4/20/2018 11:39:24 AM [NORMAL] - Language server starting --
4/20/2018 11:39:24 AM [NORMAL] -     exe: C:\WINDOWS\SysWow64\WindowsPowerShell\v1.0\powershell.exe
4/20/2018 11:39:24 AM [NORMAL] -     args: C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.6.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\logs\1524249564-c67e5e42-0cc4-4829-8c10-625edae45d701524248223012\EditorServices.log' -SessionDetailsPath 'C:\Users\emarq.REDMOND\.vscode\extensions\ms-vscode.powershell-1.6.0\sessions\PSES-VSCode-17868-293930' -FeatureFlags @()
ebmarquez commented 6 years ago

Unhandled exception

2018-04-20 11:52:52 [ERROR] - Method "OnListenTaskCompleted" at line 391 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs

    ProtocolEndpoint message loop terminated due to unhandled exception:

    System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Illegal characters in path.
       at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.DebugAdapter.<HandleSetBreakpointsRequest>d__29.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContextThread.<>c__DisplayClass4_0.<Run>b__0()
       at System.Threading.Tasks.Task.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.ArgumentException: Illegal characters in path.
       at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.DebugAdapter.<HandleSetBreakpointsRequest>d__29.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContextThread.<>c__DisplayClass4_0.<Run>b__0()
       at System.Threading.Tasks.Task.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()<---

2018-04-20 11:52:52 [ERROR] - Method "ProtocolEndpoint_UnhandledException" at line 424 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs

    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.
TylerLeonhardt commented 6 years ago

@ebmarquez Thanks for the report! Looks like the cause of this is one of the git windows:

2018-04-20 11:17:52 [VERBOSE] - Method "ResolveFilePath" at line 378 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Workspace\Workspace.cs

################## HERE v

    Resolved path: git:/e%3A/repo/DeploymentToolKit/DeploymentToolKit/NetworkAutomation/tools/jsontoyaml/NetAutomation/NetAutomation.psm1?%7B%22path%22%3A%22e%3A%5C%5Crepo%5C%5CDeploymentToolKit%5C%5CDeploymentToolKit%5C%5CNetworkAutomation%5C%5Ctools%5C%5Cjsontoyaml%5C%5CNetAutomation%5C%5CNetAutomation.psm1%22%2C%22ref%22%3A%22~%22%7D

################## HERE ^

2018-04-20 11:17:52 [ERROR] - Method "OnListenTaskCompleted" at line 391 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs

    ProtocolEndpoint message loop terminated due to unhandled exception:

    System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Illegal characters in path.
       at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.DebugAdapter.<HandleSetBreakpointsRequest>d__29.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContextThread.<>c__DisplayClass4_0.<Run>b__0()
       at System.Threading.Tasks.Task.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.ArgumentException: Illegal characters in path.
       at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.DebugAdapter.<HandleSetBreakpointsRequest>d__29.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContextThread.<>c__DisplayClass4_0.<Run>b__0()
       at System.Threading.Tasks.Task.InnerInvoke()
       at System.Threading.Tasks.Task.Execute()<---

2018-04-20 11:17:52 [ERROR] - Method "ProtocolEndpoint_UnhandledException" at line 424 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs

    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.

This has been fixed in:

https://github.com/PowerShell/PowerShellEditorServices/pull/645

and will be in the next release coming next week!

TylerLeonhardt commented 6 years ago

Closing this since the release went out today. If you're still seeing the same issue, please reach out!