-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Languageparser, language semanticsparser, language semantics
Description
It appears that [ValidateScript()] performs conditional enumeration on the argument before invoking the validation script. Is there a way to access the unenumerated argument from the validation script?
Steps to reproduce
function f {
param
(
[ValidateScript({($_[0] -eq 1) -and ($_[1] -eq 2)})]$x
)
'success'
}
f -x 1,2Expected behavior
success
Actual behavior
f : Cannot validate argument on parameter 'x'. The "($_[0] -eq 1) -and ($_[1] -e
q 2)" validation script for the argument with value "1" did not return a result
of True. Determine why the validation script failed, and then try the command ag
ain.
At C:\test.ps1:9 char:6
+ f -x 1,2
+ ~~~
+ CategoryInfo : InvalidData: (:) [f], ParameterBindingValidationExcept
ion
+ FullyQualifiedErrorId : ParameterArgumentValidationError,f
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0
PSEdition Core
GitCommitId v6.0.0
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0 mklement0, Bill-Stewart, ili101 and phatmandrake
Metadata
Metadata
Assignees
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Languageparser, language semanticsparser, language semantics