Skip to content

Error message needs to update when suspend is supplied to WarningAction #2077

@bingbing8

Description

@bingbing8

Steps to reproduce

PS C:\WINDOWS\system32> write-output 'test' -WarningAction Suspend
Write-Output : Cannot bind parameter 'WarningAction' to the target. Exception setting "WarningAction": "The action
preference of "Suspend" is supported only for ErrorAction."
At line:1 char:36
+ write-output 'test' -WarningAction Suspend
+                                    ~~~~~~~
    + CategoryInfo          : WriteError: (:) [Write-Output], ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.WriteOutputCommand

Expected behavior

Right error message. The reality is Suspend is not supported by ErrorAction either.

Actual behavior

"The action preference of "Suspend" is supported only for ErrorAction."

Environment data

PS C:\WINDOWS\system32> $PSversiontable

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions