Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

The -ProgressAction parameter doesn't work (PowerShell 7.4.1 only) #21074

Copy link
Copy link
@skycommand

Description

@skycommand
Issue body actions

Prerequisites

Steps to reproduce

Upon using the -ProgressAction switch, PowerShell returns an error message regardless of correct formatting. Please see the examples below.

Expected behavior

PS > Expand-Archive -Path .\1.zip -DestinationPath ".\1" -ProgressAction 'SilentlyContinue'

PS > Repair-Volume -DriveLetter c -Scan -ProgressAction 'SilentlyContinue'

NoErrorsFound

Actual behavior

PS > Expand-Archive -Path .\1.zip -DestinationPath ".\1" -ProgressAction 'SilentlyContinue'

Expand-Archive: Cannot convert value "SilentlyContinue" to type "System.Collections.IEnumerator". Error: "Invalid cast from 'System.Management.Automation.ActionPreference' to 'System.Collections.IEnumerator'."

PS > Repair-Volume -DriveLetter c -Scan -ProgressAction 'SilentlyContinue'

Repair-Volume: Cannot convert value "SilentlyContinue" to type "System.Collections.IEnumerator". Error: "Invalid cast from 'System.Management.Automation.ActionPreference' to 'System.Collections.IEnumerator'."

Error details

Exception             :
    Type           : System.Management.Automation.PSInvalidCastException
    ErrorRecord    :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : Cannot convert value "SilentlyContinue" to type "System.Collections.IEnumerator". Error: "Invalid cast from 'System.Management.Automation.ActionPreference'
to 'System.Collections.IEnumerator'."
            HResult : -2146233087
        CategoryInfo          : InvalidArgument: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : InvalidCastIConvertible
    TargetSite     :
        Name          : ConvertIConvertible
        DeclaringType : System.Management.Automation.LanguagePrimitives
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message        : Cannot convert value "SilentlyContinue" to type "System.Collections.IEnumerator". Error: "Invalid cast from 'System.Management.Automation.ActionPreference' to
'System.Collections.IEnumerator'."
    InnerException :
        Type       : System.InvalidCastException
        TargetSite :
            Name          : DefaultToType
            DeclaringType : System.Convert
            MemberType    : Method
            Module        : System.Private.CoreLib.dll
        Message    : Invalid cast from 'System.Management.Automation.ActionPreference' to 'System.Collections.IEnumerator'.
        Source     : System.Private.CoreLib
        HResult    : -2147467262
        StackTrace :
   at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
   at System.Management.Automation.LanguagePrimitives.ConvertIConvertible(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable)
    Source         : System.Management.Automation
    HResult        : -2147467262
    StackTrace     :
   at System.Management.Automation.LanguagePrimitives.ConvertIConvertible(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable)
   at System.Management.Automation.LanguagePrimitives.ConversionData`1.Invoke(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert,
IFormatProvider formatProvider, TypeTable backupTable)
   at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable
backupTypeTable)
   at System.Management.Automation.LanguagePrimitives.ConvertTo[T](Object valueToConvert)
   at System.Management.Automation.MutableTuple`64.SetValueImpl(Int32 index, Object value)
   at System.Management.Automation.PSScriptCmdlet.SetPreferenceVariables()
   at System.Management.Automation.PSScriptCmdlet.BeginProcessing()
   at System.Management.Automation.Cmdlet.DoBeginProcessing()
   at System.Management.Automation.CommandProcessorBase.DoBegin()
CategoryInfo          : InvalidArgument: (:) [Repair-Volume], PSInvalidCastException
FullyQualifiedErrorId : InvalidCastIConvertible,Repair-Volume
InvocationInfo        :
    MyCommand        : Repair-Volume
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 2
    Line             : Repair-Volume -DriveLetter c -Scan -ProgressAction 'SilentlyContinue'
    Statement        : Repair-Volume -DriveLetter c -Scan -ProgressAction 'SilentlyContinue'
    PositionMessage  : At line:1 char:1
                       + Repair-Volume -DriveLetter c -Scan -ProgressAction 'SilentlyContinue'
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Repair-Volume
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

Output

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issue

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.