You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the type of PS.``Get-Variable`` is PsCmdletResult<List<PSVariable>,List<ErrorRecord>>.
The script makes three calls:
Get-Variable returns a variable, the result is Success [System.Management.Automation.PSVariable].
Get-Variable writes a non-terminating error, the result is Success [].
Get-Variable writes a terminating error, this results in an exception.
[Loading ...\TestError.fsx]
Success [System.Management.Automation.PSVariable]
Success []
System.Management.Automation.ActionPreferenceStopException: The running command
stopped because the preference variable "ErrorActionPreference" or common
parameter is set to Stop: Cannot find a variable with the name 'Missing'.
...
Stopped due to error
Thus, TFailure of PsCmdletResult<TSuccess, TFailure> is never used.
Is this a bug? What is the expected result in (2) and (3), by design?
The design of the result type is not clear, though. It does not cover all
possible cases, for example a case when a command writes both data and
errors, e.g. with existing and missing variables specified at the same
time on Get-Variable calls.
The text was updated successfully, but these errors were encountered:
In the following script
the type of
PS.``Get-Variable``
isPsCmdletResult<List<PSVariable>,List<ErrorRecord>>
.The script makes three calls:
Get-Variable
returns a variable, the result isSuccess [System.Management.Automation.PSVariable]
.Get-Variable
writes a non-terminating error, the result isSuccess []
.Get-Variable
writes a terminating error, this results in an exception.Thus,
TFailure
ofPsCmdletResult<TSuccess, TFailure>
is never used.Is this a bug? What is the expected result in (2) and (3), by design?
The design of the result type is not clear, though. It does not cover all
possible cases, for example a case when a command writes both data and
errors, e.g. with existing and missing variables specified at the same
time on
Get-Variable
calls.The text was updated successfully, but these errors were encountered: