Skip to content

Changing breakpoints during execution causes a hang #1658

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
LazerFX opened this issue Dec 14, 2018 · 4 comments
Closed

Changing breakpoints during execution causes a hang #1658

LazerFX opened this issue Dec 14, 2018 · 4 comments
Labels

Comments

@LazerFX
Copy link

LazerFX commented Dec 14, 2018

Issue Description

When I try and change breakpoints during script execution, the output hangs when it encounters any breakpoint that is already set.

Reproduction steps

  1. Open a PowerShell in VS Code that will take a long time to execute (I was using one that called Import-Module AWSPowerShell.NetCore which takes on the region of 20 - 30 seconds.
  2. Ensure that a breakpoint is set, after the long-running section
  3. While the script is executing, place a new breakpoint or remove the existing breakpoint in the file
  4. Execution will hang at an indeterminate position in the file

I've already looked at #1589 which references #1263, but those don't appear to be the same bug (To me, at least).
I saw #1494 which appears similar but has a different trigger (To me, at least - it may be the same problem)
#1163 also appears similar, but with a different actualisation.

Please accept my apologies if this is the same as one of these existing bugs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.17763
VSCode 1.30.0
PowerShell Extension Version 1.10.1

PowerShell Information

Name Value
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.1.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
aurelia AureliaEffect 1.0.3
azurecli ms-vscode 0.4.2
beautify HookyQR 1.4.7
csharp ms-vscode 1.17.1
gitignore codezombiech 0.6.0
gitlens eamodio 9.2.0
nuget-reverse-package-search jesschadwick 0.1.68
PowerShell ms-vscode 1.10.1
team ms-vsts 1.144.1
terraform mauve 1.3.7
tslint eg2 1.0.41
vetur octref 0.14.3
vscode-docker PeterJausovec 0.4.0
vscode-helm technosophos 0.4.0
vscode-kubernetes-tools ms-kubernetes-tools 0.1.14
vscode-markdownlint DavidAnson 0.22.0
vscode-npm-script eg2 0.3.5
vscode-nuget-package-manager jmrog 1.1.6
vscode-solution-explorer fernandoescolar 0.3.0
vscode-yaml redhat 0.1.0
vsliveshare ms-vsliveshare 0.3.1013
vsliveshare-audio ms-vsliveshare 0.1.45
xml DotJoshJohnson 2.3.2
@TylerLeonhardt
Copy link
Member

Thanks for the info! Can you also attach the logs here so we can get a better idea of what's going on?

Please set the Log Level to Diagnostic.

@LazerFX
Copy link
Author

LazerFX commented Dec 14, 2018

I cannot get an output file when I turn on the diagnostic logging - I get an exception saying Cannot read property 'onError' of undefined.

The following is output into the [TEMP] PowerShell Integrated Window:

VERBOSE:
#-- Console Encoding ---------------------------------------------------------
VERBOSE: System.Text.UTF8Encoding
VERBOSE:
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: C:\Users\pstreet\Documents\PowerShell\Modules
VERBOSE: C:\Program Files\PowerShell\Modules
VERBOSE: c:\program files\powershell\6\Modules
VERBOSE: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
VERBOSE: C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.1\modules
VERBOSE:
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet
VERBOSE: Loading module from path 'C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1'.
VERBOSE: PowerShellGet  found
VERBOSE:
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Loading module from path 'C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.1\modules\PowerShellEditorServices\PowerShellEditorServices.psm1'.
VERBOSE: Exporting function 'Start-EditorServicesHost'.
VERBOSE: Exporting function 'Compress-LogDir'.
VERBOSE: Exporting function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
PowerShell Integrated Console

VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: Start-EditorServicesHost returned Microsoft.PowerShell.EditorServices.Host.EditorServicesHost
VERBOSE: Writing session file with contents:
VERBOSE: {"languageServicePipeName":"\\\\.\\pipe\\PSES_ih431xei.35b","debugServiceTransport":"NamedPipe","languageServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_f3yr35uf.txt"}
VERBOSE: Wrote out session file
VERBOSE:
#-- Waiting for EditorServicesHost to complete execution ---------------------

And the following is the contents of the launch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File",
            "script": "${file}",
            "args": [],
            "cwd": "${file}"
        },
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File in Temporary Console",
            "script": "${file}",
            "args": [],
            "cwd": "${file}",
            "createTemporaryIntegratedConsole": true
        },
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File w/Args Prompt",
            "script": "${file}",
            "args": [
                "${command:SpecifyScriptArgs}"
            ],
            "cwd": "${file}"
        },
        {
            "type": "PowerShell",
            "request": "attach",
            "name": "PowerShell Attach to Host Process",
            "processId": "${command:PickPSHostProcess}",
            "runspaceId": 1
        },
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Interactive Session",
            "cwd": ""
        }
    ]
}

I haven't changed launch.json in any way, so it should be default. We are using Powershel 6.1 as our command. The following have been changed from default in the powershell configuration:

{
    "powershell.debugging.createTemporaryIntegratedConsole": true,
    "powershell.powerShellExePath": "C:\\Program Files\\PowerShell\\6\\pwsh.exe"
}

@LazerFX
Copy link
Author

LazerFX commented Dec 21, 2018

I've got a further update on the launch.json (This may need opening as a new issue, please feel free to let me know - I'll push one in if it is):

There's an error happening in the EditorServices.log file:

Editor Services Log File

2018-12-21 11:37:16.554 [NORMAL] tid:15 in 'StartLogging' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 183
    
    PowerShell Editor Services Host v1.10.2.0 starting (PID 10164
    
      Host application details:
    
        Name:      Visual Studio Code Host
        Version:   1.10.2
        ProfileId: Microsoft.VSCode
        Arch:      X64
    
      Operating system details:
    
        Version: Microsoft Windows 10.0.17763 
        Arch:    X64
    
      Build information:
    
        Version: <development-build>
        Origin:  <development>
        Date:    2018-12-19T00:48:09
    

2018-12-21 11:37:16.638 [NORMAL] tid:15 in 'StartLanguageService' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 202
    Language service started, type = NamedPipe, endpoint =  InOut pipe: PSES_irmbkzky.2zp

2018-12-21 11:37:16.650 [NORMAL] tid:15 in 'StartDebugService' C:\PowerShellEditorServices\src\PowerShellEditorServices.Host\EditorServicesHost.cs: line 279
    Debug service started, type = NamedPipe, endpoint =  InOut pipe: PSES_akmzsy0u.sz3

2018-12-21 11:37:18.285 [NORMAL] tid:4 in 'Initialize' C:\PowerShellEditorServices\src\PowerShellEditorServices\Session\PowerShellContext.cs: line 221
    PowerShell runtime version: 6.1.0, edition: Core

2018-12-21 11:37:19.167 [ERROR] tid:14 in 'ExecuteCommand' C:\PowerShellEditorServices\src\PowerShellEditorServices\Session\PowerShellContext.cs: line 565
    Execution of the following command(s) completed with errors:
    
        Import-Module C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\bin\Core\..\..\Commands\PowerShellEditorServices.Commands.psd1
    
    

2018-12-21 11:37:19.262 [NORMAL] tid:18 in 'Register' C:\PowerShellEditorServices\src\PowerShellEditorServices.VSCode\ComponentRegistration.cs: line 36
    PowerShell Editor Services VS Code module loaded.

2018-12-21 11:39:37.320 [WARNING] tid:22 in 'DispatchMessage' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageDispatcher.cs: line 147
    MessageDispatcher: No handler registered for Event type '$/setTraceNotification'

In order to diagnose this, I tried to get that file in a pwsh.exe prompt:

The output from the console:

PowerShell 6.1.0
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS C:\Users\pstreet> Import-Module C:\Users\pstreet\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\bin\Core\..\..\Commands\PowerShellEditorServices.Commands.psd1
PS C:\Users\pstreet> Get-Module PowerShellEditorServices.Commands

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.2.0      PowerShellEditorServices.Commands   {ConvertFrom-ScriptExtent, ConvertTo-ScriptExtent, Find-As...


PS C:\Users\pstreet> Get-Command -Module PowerShellEditorServices.Commands

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        ConvertFrom-ScriptExtent                           0.2.0      PowerShellEditorServices.Commands
Function        ConvertTo-ScriptExtent                             0.2.0      PowerShellEditorServices.Commands
Function        Find-Ast                                           0.2.0      PowerShellEditorServices.Commands
Function        Get-Token                                          0.2.0      PowerShellEditorServices.Commands
Function        Import-EditorCommand                               0.2.0      PowerShellEditorServices.Commands
Function        Join-ScriptExtent                                  0.2.0      PowerShellEditorServices.Commands
Function        New-EditorFile                                     0.2.0      PowerShellEditorServices.Commands
Function        Open-EditorFile                                    0.2.0      PowerShellEditorServices.Commands
Function        Out-CurrentFile                                    0.2.0      PowerShellEditorServices.Commands
Function        Register-EditorCommand                             0.2.0      PowerShellEditorServices.Commands
Function        Set-ScriptExtent                                   0.2.0      PowerShellEditorServices.Commands
Function        Test-ScriptExtent                                  0.2.0      PowerShellEditorServices.Commands
Function        Unregister-EditorCommand                           0.2.0      PowerShellEditorServices.Commands


PS C:\Users\pstreet>

Sorry I can't give any further information - I'm not sure exactly where to look.

@rjmholt
Copy link
Contributor

rjmholt commented May 6, 2019

Deduplicating this to #1494

@rjmholt rjmholt closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants