KB3009 - PowerShell Pro Tools for VS Code "failed to connect"

KB3009 - PowerShell Pro Tools for VS Code "failed to connect"

Scope

This article only applies to PowerShell Pro Tools for VS Code on the Windows operating system.

If you are using PowerShell Pro Tools for VS Code for Mac or Linux then this article does not apply

Problem

The PowerShell Pro Tools extension for VS Code fails to connect after some time. This may result in features being unavailable (i.e. "command not found")



Symptoms

The first symptom will be a status of "PowerShell Pro Tools is connecting..." for more than a couple of seconds.


(figure shows the first symptom - PowerShell Pro Tools for VS Code extension is trying to connect)

Versions 2023.9.0 and below, 2024.2.0 and above
The status will remain at the first symptom.

Versions 2023.12.1, 2023.12.2
After a couple of minutes, the extension will stop trying will present the below status window with a recommendation to check the Output channel.

(figure shows the second symptom on version 2023.12.2)

Version 2023.12.0
Same as 2023.12.1,  but the application will also eventually exhaust its available memory and terminate.

Root cause

The issue can occur in the PowerShell Pro Tools VS code extension when a non-existent backup path is defined in the windowState section of the VS Code user cache. See below.


(figure shows an example of a non-existent path defined in the windowState section of the storage.json in the VS Code user cache)


(figure shows the typical location of the storage.json file in the VS Code user cache)

Workarounds

A list of workarounds to choose from is below. Please be sure to close VS Code before proceeding.

1) Disable persistent sessions in VS Code (shown below). We apologize for this inconvenience. This setting controls whether or not VS Code will not remember the exact state of its child windows when it was closed. This incompatibility between PowerShell Pro Tools for VS Code and the persistent session feature will be fixed in the future.



Workaround #2

1) Edit the storage.json to remove the workSpace section (zero impact, best solution) (see below)


(figure demonstrates how to edit the storage.json file with NotePad)

Workaround #3

Delete the storage.json file altogether (should be low impact)

Remove the %APPDATA%\Code folder altogether. This will effectively reset all of the user settings.

Final Step 🏁

After applying one of the above workarounds, start VS Code and after a few seconds (depending on your computer performance) you should see the extension connect and turn green (see below).


(figure shows the PowerShell Pro Tools extension for VS Code successfully connected)


    • Related Articles

    • KB3010 - PowerShell Pro Tools for VS Code "command not found"

      Scope This article only applies to PowerShell Pro Tools for VS Code on the Windows operating system. If you are using PowerShell Pro Tools for VS Code for Mac or Linux then this article does not apply Problem The PowerShell Pro Tools extension for VS ...
    • KB3003 - Resetting PowerShell Pro Tools (VS Code)

      Problem PowerShell Pro Tools (for VS Code) is not behaving as expected. For example, pressing the 'Show Form Designer' button does not successfully launch PSScriptPad (only the splash screen is shown). Solution This solution assumes that you have VS ...
    • KB3002 - PowerShell Pro Tools for VS Code (2002) stopped working

      Scope This is a legacy article which only applies to PowerShell Pro Tools for VS Code version 2022.7.2 and below If your PowerShell Pro Tools for VS Code is at 2022.8.0 or higher then this article does not apply Problem PowerShell Pro Tools extension ...
    • KB3008 - About PowerShell Pro Tools Licensing

      Scope Anyone who has purchased a license for PowerShell Pro Tools Question How many machines can I install PowerShell Pro Tools (PowerShell module, PowerShell Pro Tools for VS. Code or PowerShell Tools for Visual Studio? Answer PowerShell Pro Tools ...
    • KB3001 - How do I install license for Posh Pro Tools for VS Code

      Standard Method After the extension is installed, you will be presented with a menu similar to the screenshot below. (figure shows the Install License button after installing the extension) 2. Click Install License and select your license.txt (or ...