Vscode-powershell: Preview extension not loading

Created on 24 Jan 2019  Â·  19Comments  Â·  Source: PowerShell/vscode-powershell

System Details

### VSCode version: 1.30.2 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8 x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version:

### PowerShell version:

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

Issue Description

I am experiencing a problem with getting the preview extension to load, after disabling the release extension

Expected Behaviour

Extension should load; be able to open the Integrated Console, access PowerShell options from the command pallet; etc.

Actual Behaviour

command 'PowerShell.OpenLogFolder' not found
command 'PowerShell.ShowSessionConsole' not found
command 'PowerShell.RestartSession' not found

Attached Logs

Logs never generate. 👎

Issue-Bug Preview Extension

Most helpful comment

I've figured this out and have a fix for it. Will submit a PR soon.

All 19 comments

Have you disabled the non-preview version of the PowerShell extension? Sorry, looks like you disable the non-preview extension. Reloading VSCode doesn't help?

Yes. Even tried uninstalling it as well.

On Wed, Jan 23, 2019, 10:41 PM Keith Hill <[email protected] wrote:

Have you disabled the non-preview version of the PowerShell extension?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/PowerShell/vscode-powershell/issues/1721#issuecomment-457055819,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHOSOilr1es-RDNkBu2s5-xM9O8Vpw5Xks5vGSt6gaJpZM4aQE95
.

Odd... Random question... Did you open a folder with vscode or just a blank instance?

Blank instance

Sent from mobile

On Wed, Jan 23, 2019, 11:51 PM Tyler James Leonhardt <
[email protected] wrote:

Odd... Random question... Did you open a folder with vscode or just a
blank instance?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/PowerShell/vscode-powershell/issues/1721#issuecomment-457066349,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHOSOiRg_UfmjZjRbGWxQDRk9az9uWYBks5vGTvagaJpZM4aQE95
.

Having the same problem (on both my home and work machines), and it only seems to happen if I'm not working within a folder (workspace?) in VS Code.

Same thing for me when in an untitled workspace. It's almost like the activation event doesn't get sent, but the extension host log does indeed show it.

[2019-01-24 09:26:14.884] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.PowerShell-Preview {"startup":false,"activationEvent":"onLanguage:powershell"}
[2019-01-24 09:26:14.884] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\user\.vscode\extensions\ms-vscode.powershell-preview-2.0.0\out\src\main

So strange... I wonder if this has something to do with the extension name being "PowerShell Preview" I'll run some tests.

I can repro this with a CI build that isn't marked "Preview" as well.

Another confirmation. Opening a new file, doesn't trigger loading of the preview extension. If I load a folder, and then open a .ps1 file, preview extension is loaded as expected.

Interesting note; it works fine on my work PC.

### VSCode version: 1.30.2 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8 x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.134
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.134
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
      Another confirmation. Opening a new file, doesn't trigger loading of the preview extension. If I load a folder, and then open a .ps1 file, preview extension is loaded as expected.

Same here.

I've figured this out and have a fix for it. Will submit a PR soon.

PR here ^ for those interested in testing it out. You can grab a CI build here:

https://ci.appveyor.com/project/PowerShell/vscode-powershell/builds/21895485/artifacts

Let me know if that fixes it for you 😄

The CI build is working for me.
Only oddity is that it looks to have replaced/upgraded the "stable" extension version rather than the preview one.

Yeah that was intentional. Ignore that.

I imagine this is related, so I'll post it here:

When building master, I was getting the message "Activating extension 'ms-vscode.PowerShell' failed: Cannot read property 'toLowerCase' of undefined." pop up. When I loaded a workspace then it loaded without problem.

Activating extension 'ms-vscode.PowerShell' failed: Cannot read property 'toLowerCase' of undefined.

Based on this line: https://github.com/PowerShell/vscode-powershell/pull/1728/files#diff-8cfead41d88ad47d44509a8ab0a109adR163 I'll leave this here as related. If it's not related let me know and I'll open a new issue.

Hmm, if this is indeed the spot where this error originates then it seems that for some reason context.extensionPath is also returning undefined.

In local testing I confirmed that context.extensionPath wasn't null... But that's my machine â„¢...

I suppose we can have a default if it _IS_ null... Or I might just do this work: https://github.com/Microsoft/vscode/issues/66515#issuecomment-456508074

I updated https://github.com/PowerShell/vscode-powershell/pull/1728 to have a default of __dirname if all else fails.

Was this page helpful?
0 / 5 - 0 ratings