-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issue
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
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
ninbura, hilari0n, ALiwoto, janheindejong, mattcargile and 1 more
Metadata
Metadata
Assignees
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issue
