PowerShell Pro Tools not loading in VS Code

Tool: Visual Studio Code, PSScriptPad
Version: 5.28.10
VS Code Version: 1.58.0

I went through a few of the topics that mention the same issue I am experiencing, but some of the fixes that worked for other people have not worked for me.

What I have tried:

  1. uninstalling/reinstalling the extension
  2. Installing a previous version 5.28.7
  3. Disabling DEP for Code.exe, PowerShellProTools.Host.exe and PSScriptpad.exe
  4. Turning off providers

I still can’t seem to get it to load.

Here is the output:

Starting PowerShell Pro Tools host from: c:\Users\username\.vscode\extensions\ironmansoftware.powershellprotools-5.28.10\out\windows\PowerShellProTools.Host.exe}
Process started
[7/8/2021 3:54:04 PM] connect

Connecting to PowerShell process 9536
[7/8/2021 3:54:06 PM] Opening a remote runspace.

[7/8/2021 3:54:06 PM] Loading PowerShell Pro Tools module

[7/8/2021 3:54:06 PM] Executing command: [System.Reflection.Assembly]::LoadFrom('c:\Users\username\.vscode\extensions\ironmansoftware.powershellprotools-5.28.10\out\windows\PowerShellProTools.VSCode.dll')

[7/8/2021 3:54:07 PM] Executing command: Import-Module 'c:\Users\username\.vscode\extensions\ironmansoftware.powershellprotools-5.28.10\out\windows\PowerShellProTools.VSCode.dll'

[7/8/2021 3:54:07 PM] Executing command: $Env:PSModulePath += ';c:\Users\username\.vscode\extensions\ironmansoftware.powershellprotools-5.28.10\out\windows\..\Modules'

[7/8/2021 3:54:07 PM] Configuring runspace scheduler.

[7/8/2021 3:54:07 PM] Executing command: 
                Get-Runspace | ForEach-Object {
                    $h = $_.GetType().GetProperty('Host', [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic).GetValue($_)
                    if ($h.Name -eq 'Visual Studio Code Host') 
                    {
                        $_.Id
                    }
                }
            

[7/8/2021 3:54:07 PM] Executing command: 
                Get-Runspace | ForEach-Object {
                    $h = $_.GetType().GetProperty('Host', [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic).GetValue($_)

                    if ($h.Name -eq 'Visual Studio Code Host') 
                    {
                        $_.Id
                    }
                }
            

[7/8/2021 3:54:07 PM] Executing command: 
                Get-Runspace | ForEach-Object {
                    $h = $_.GetType().GetProperty('Host', [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic).GetValue($_)
                    if ($h.Name -eq 'Visual Studio Code Host') 
                    {
                        $_.Id
                    }
                }
            

[7/8/2021 3:54:07 PM] Executing command: 
                Get-Runspace | ForEach-Object {
                    $h = $_.GetType().GetProperty('Host', [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic).GetValue($_)
                    if ($h.Name -eq 'Visual Studio Code Host') 
                    {
                        $_.Id
                    }
                }
            

[7/8/2021 3:54:07 PM] Executing command: 
                Get-Runspace | ForEach-Object {
                    $h = $_.GetType().GetProperty('Host', [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic).GetValue($_)

                    if ($h.Name -eq 'Visual Studio Code Host') 
                    {
                        $_.Id
                    }
                }
            

[7/8/2021 3:54:07 PM] Found VS Code runspace: 5
[7/8/2021 3:54:07 PM] Executing command: 
$RS = Get-Runspace -Id 5
$RS.Events.SubscribeEvent($null, 'PowerShell.OnIdle',  'PowerShell.OnIdle', $null, { 
        try {
        $PSPCommand = [PowerShellProTools.CommandQueue]::GetCommand()
        if ($PSPCommand) 
        { 
            $PSPResults = Invoke-Expression $PSPCommand.Value
            [PowerShellProTools.CommandQueue]::SetResults($PSPResults, $PSPCommand)
        } 
        } catch { [PowerShellProTools.CommandQueue]::SetResults($_.ToString(), $PSPCommand) }
    }, $true, $false)

[7/8/2021 3:54:07 PM] Scheduling command for main runspace: Import-Module 'c:\Users\username\.vscode\extensions\ironmansoftware.powershellprotools-5.28.10\out\windows\PowerShellProTools.VSCode.dll' -Scope Global

Connected to PowerShell process.
Started PowerShell Pro Tools process.

ps. I am also having the issue where PSScriptPad will open once, and then not again, unless i close and reopen VS Code.

Can you let me know if you are using PS 7 or 5?

I have PS 7 installed, but the default for VS Code is PS 5.

Ok. Thanks. Could you do me a favor and grab a memory dump of the PowerShellProTools.Host.exe process? I want to take a look at what it’s stuck on. If you could send me a dropbox or link or someother file sharing method to adam@ironmansoftware.com, that’d be awesome.

I may have reproduced this. In WinPS 5.1 on my box, if I expand the History node in the PowerShell Pro Tools explorer, I can no longer expand any other nodes. PSScriptPad no longer opens. I have to restart VS Code to get it to function again.

Can you try hiding the History node in your environment? You can do so in settings under PowerShell Pro Tools

It may not exactly be related to History specifically as that command does run successfully for me if run directly in PS5.1. But worth a shot to see if you have a similar behavior.

So, I disabled the History and closed and reopened VS Code, and it finished loading everything, but it is not consistent. Subsequent close and reopens are hit or miss, and after a few more times, it just stopped working all together.

I’ve have tried disabling all of the nodes, except for one (tried just having variables and just having modules), but still the same issue.

You should see an email for the dump file. Let me know if you need more.

Appreciate your assistance in this.

Great. Thanks for trying. I’ll take a look at the dump and let you know if I need any more information.

After looking at the dump, I’ve identified an issue and will get a new release out. I’ve also optimized the History tab so that doesn’t cause issues when expanded.

Awesome. Thank you. Looking forward to the update.