Skip to content
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

Session startup should indicate if the current PowerShell version is unsupported #401

Closed
Bill-Stewart opened this issue Dec 19, 2016 · 9 comments
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@Bill-Stewart
Copy link

  • Operating system name and version: Windows Server 2008 R2
  • VS Code version: 1.8.0
  • PowerShell extension version: 0.8.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
CLRVersion                     2.0.50727.5485
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

Issue description:

Error when starting PowerShell module. ERROR: Remove-Module : No modules were removed. Verify that the specification of modules to remove is correct and those modules exist in the runspace.

Attached Logs

powershell.exe started --
pid: 13860
exe: C:\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe
bundledModulesPath: C:\Users\user.vscode\extensions\ms-vscode.PowerShell-0.8.0\modules
args: C:\Users\user.vscode\extensions\ms-vscode.PowerShell-0.8.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '0.8.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '0.8.0' -BundledModulesPath 'C:\Users\user.vscode\extensions\ms-vscode.PowerShell-0.8.0\modules' -LogLevel 'Normal' -LogPath 'C:\Users\user.vscode\extensions\ms-vscode.PowerShell-0.8.0\logs\1482165307-496ebe8d-afa6-4b54-acf1-7aa0e16fed961482165300434\EditorServices.log'

PowerShell could not be started, click 'Show Logs' for more details.

ERROR: Remove-Module : No modules were removed. Verify that the specification of modul
ERROR: es to remove is correct and those modules exist in the runspace.
At C:\Users\user.vscode\extensions\ms-vscode.PowerShell-0.8.0\scripts\Start-EditorServices.ps1:63 char:18
+ Remove-Module <<<< PSReadline
+ CategoryInfo : ResourceUnavailable: (:) [Remove-Module], InvalidOperationException
+ FullyQualifiedErrorId : Modules_NoModulesRemoved,
Microsoft.PowerShell.Commands.RemoveModuleCommand

@daviwil
Copy link
Contributor

daviwil commented Dec 19, 2016

Hi Bill, unfortunately we don't support PowerShell v2 at this time and we currently have no plans to do so. Regardless of that, you did indeed find a bug with our startup script. When I fix that issue, I'll make sure to include a check for the PowerShell version so that we can let the user know our lack of support for anything below PSv3.

@daviwil daviwil added the Issue-Bug A bug to squash. label Dec 19, 2016
@daviwil daviwil added this to the 0.8.1 milestone Dec 19, 2016
@Bill-Stewart
Copy link
Author

Unfortunately I can't upgrade PowerShell on this particular machine at this time. It would be nice not to see this error. Understood that there's some stuff that might not work on PS v2.

@Bill-Stewart
Copy link
Author

FYI, I also see this error message after closing the previous error:

Error  Running the contributed command:'PowerShell.ShowSessionMenu' failed.

@daviwil daviwil changed the title Initialization error: Remove-Module : No modules were removed. Session startup should indicate if the current PowerShell version is unsupported Dec 19, 2016
@daviwil
Copy link
Contributor

daviwil commented Dec 19, 2016

I've got a fix prepared to smooth out the rough edges when the extension is loaded on a machine with PowerShell v2. Also fixed the issue where the session menu throws an error if you click the status bar item when there was a startup failure.

#406

daviwil added a commit that referenced this issue Dec 19, 2016
Fix #401: Session startup should indicate if PS version is unsupported
@Bill-Stewart
Copy link
Author

Still seeing the following error (vscode 1.8.1, Windows Server 2008 R2, module version 0.9.0):

ERROR: Remove-Module : No modules were removed. Verify that the specification of modul
ERROR: es to remove is correct and those modules exist in the runspace.
At C:\Users\<username>\.vscode\extensions\ms-vscode.PowerShell-0.8.0\scripts\Start-EditorServices.ps1:63 char:18
+     Remove-Module <<<<  PSReadline
    + CategoryInfo          : ResourceUnavailable: (:) [Remove-Module], InvalidOperationException
    + FullyQualifiedErrorId : Modules_NoModulesRemoved,Microsoft.PowerShell.Commands.RemoveModuleCommand

@daviwil
Copy link
Contributor

daviwil commented Jan 24, 2017

Looks like it's running extension 0.8.0? From the log you pasted:

C:\Users\<username>\.vscode\extensions\ms-vscode.PowerShell-0.8.0\ ...

In 0.9.0, the PowerShell version gets checked before the Remove-Module call occurs so this shouldn't be happening if the correct extension version is running. Let me know what you find!

@Bill-Stewart
Copy link
Author

Sorry, I pasted the wrong text. This is the actual error:

powershell.exe started --
    pid: 18676
    exe: C:\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe
    bundledModulesPath: C:\Users\IHSNetIQDRAService\.vscode\extensions\ms-vscode.PowerShell-0.9.0\modules
    args: C:\Users\<username>\.vscode\extensions\ms-vscode.PowerShell-0.9.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '0.9.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '0.9.0' -BundledModulesPath 'C:\Users\IHSNetIQDRAService\.vscode\extensions\ms-vscode.PowerShell-0.9.0\modules' -LogLevel 'Normal' -LogPath 'C:\Users\IHSNetIQDRAService\.vscode\extensions\ms-vscode.PowerShell-0.9.0\logs\1485270425-bceb1c5e-0626-46ef-86f8-ef67836680521485270420152\EditorServices.log' 
PowerShell could not be started, click 'Show Logs' for more details.
ERROR: The term 'ConvertTo-Json' is not recognized as the name of a cmdlet, function, 
ERROR: script file, or operable program. Check the spelling of the name, or if a path 
was included, verify that the path is correct and try again.
At C:\Users\<username>\.vscode\extensions\ms-vscode.PowerShell-0.9.0\scripts\Start-EditorServices.ps1:66 char:33
    + Write-Output (ConvertTo-Json <<<<  -InputObject $resultDetails -Compress)
    + CategoryInfo          : ObjectNotFound: (ConvertTo-Json:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

@daviwil
Copy link
Contributor

daviwil commented Jan 24, 2017

Ouch! Clearly I didn't test that on a PowerShell v2 machine :) Thanks for pointing that out, I'll fix it in 0.9.1.

@daviwil daviwil reopened this Jan 24, 2017
@daviwil daviwil modified the milestones: 0.9.1, 0.9.0 Jan 24, 2017
@Bill-Stewart
Copy link
Author

Thanks!

@daviwil daviwil modified the milestones: 0.10.1, 0.9.1 Mar 14, 2017
daviwil added a commit that referenced this issue Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

2 participants