Skip to content

Entering a string for a switch parameter causes powershell to crash #1450

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
andy2002a opened this issue Jul 24, 2018 · 1 comment
Closed
Assignees

Comments

@andy2002a
Copy link

System Details

  • Operating system name and version:
  • VS Code version:
  • PowerShell extension version: 1.8.1
  • Output from $PSVersionTable:

Name Value


PSVersion 5.1.14393.2312
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2312
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v
1.25.1
1dfc5e557209371715f655691b1235b6b26a06be
x64

$pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      8      1      0

code --list-extensions --show-versions
[email protected]
[email protected]

$PSVersionTable

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

Issue Description

Steps to Reproduce:

1.Run the command block below
2.Enter random text when prompted in the console
3.You get an error saying that powershell crashed

If you launch the same code in the ISE you will get an error in the console saying that the switch param will not accept a string. However, the shell will not crash.

[cmdletbinding()]
param(
    [Parameter(Mandatory = $true, HelpMessage = 'test')]
    [Switch]$ServerName,

    [Parameter(Mandatory = $true, HelpMessage = 'test')]
    [Switch]$Server2Name

)#End cmdletbinding

Attached Logs

Sent to [email protected]

@TylerLeonhardt
Copy link
Member

I managed to grab a picture of the crash that flashes when executing the code above

screen shot 2018-07-30 at 11 42 25 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants