Closed
Description
System Details
- Operating system name and version:
- VS Code version:
- PowerShell extension version:
- Output from
$PSVersionTable
:
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
PS C:\Users\corm\Documents> code -v
1.16.1
27492b6bf3acb0775d82d2f87b25a93490673c6d
PS C:\Users\corm\Documents> $pseditor.EditorServicesVersion
Major Minor Build Revision
----- ----- ----- --------
1 4 1 0
PS C:\Users\corm\Documents> code --list-extensions --show-versions
donjayamanne.python@0.7.0
formulahendry.code-runner@0.7.2
gerane.Theme-Monokai-Contrast@0.0.2
idleberg.hopscotch@0.2.0
ms-vscode.cpptools@0.13.0
ms-vscode.csharp@1.12.1
ms-vscode.PowerShell@1.4.3
zhuangtongfa.Material-theme@2.10.12
PS C:\Users\corm\Documents> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.15063.608
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.608
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
I have the following in a temp.ps1
script:
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[bool]$Foo
)
$Foo
When I run .\temp.ps1
with no parameters, I get prompted to provided a value for Foo
, which I immediately press ENTER, assigning False to Foo
. When running in the powershell
tab in VS Code, I see the following:
corm@CORMAC : ~\Documents : 10/3/2017 4:37:58 PM :
> .\temp.ps1
cmdlet temp.ps1 at command pipeline position 1
Supply values for the following parameters:
Foo:
False
However, when I run the same thing in the PowerShell Integrated Console
tab in VS Code, I see the following:
PS C:\Users\corm\Documents> .\temp.ps1
cmdlet temp.ps1 at command pipeline position 1
Supply values for the following parameters:
Foo:
C:\Users\corm\Documents\temp.ps1 : Cannot process argument transformation on parameter 'Foo'. Cannot convert value "" to type "System.Boolean". Boolean parameters accept only Boolean values and
numbers, such as $True, $False, 1 or 0.
At line:1 char:1
+ .\temp.ps1
+ ~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [temp.ps1], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,temp.ps1
I may be unaware of the underlying difference(s) between powershell
and PowerShell Integrated Console
, so please let me know if this is expected behavior 😃
Attached Logs
See above.
Metadata
Metadata
Assignees
Labels
No labels