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
{{ message }}
Repository navigation
6.2.0-rc.1 Remove-Item -Recurse broken for reparse points #9246
in 6.1.2 this command works : Remove-Item C:\Users\david\OneDrive\Documents\ -Recurse
but in 6.2.0-rc.1 I get this error
PS C:\Users\david> Remove-Item C:\Users\david\OneDrive\Documents\ -Recurse
Remove-Item : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
At line:1 char:1
PSMessageDetails :
Exception : System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object arg0)
at System.Management.Automation.Internal.StringUtil.Format(String formatSpec, Object o)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force,
Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String path, Boolean recurse,
CmdletProviderContext context)
TargetObject :
CategoryInfo : NotSpecified: (:) [Remove-Item], FormatException
FullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.RemoveItemCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , : line 1
PipelineIterationInfo : {}
Message : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Data : {}
InnerException :
TargetSite : System.Text.StringBuilder AppendFormatHelper(System.IFormatProvider, System.String, System.ParamsArray)
StackTrace : at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object arg0)
at System.Management.Automation.Internal.StringUtil.Format(String formatSpec, Object o)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean
rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String path, Boolean recurse,
CmdletProviderContext context)
HelpLink :
Source : System.Private.CoreLib
HResult : -2146233033
I guess it is not complex fix. I guess we need detect surrogate reparse points. If I remember correctly we already did this for read operations. Also I saw such code in .Net Core for Delete().
I was at work when I got the notification so I thought I would just get the answer without testing 😝Of course 7.2 is on all my systems so I can test... And now I know I have to since there is no pre baked answer.
Activity
powercode commentedon Mar 29, 2019
David Baribeault (@Baribeault) Can you add the output of
Baribeault commentedon Mar 29, 2019
PS C:\Users\david> $error[0] | fl -showerror -force *
PSMessageDetails :
Exception : System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object arg0)
at System.Management.Automation.Internal.StringUtil.Format(String formatSpec, Object o)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force,
Boolean rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String path, Boolean recurse,
CmdletProviderContext context)
TargetObject :
CategoryInfo : NotSpecified: (:) [Remove-Item], FormatException
FullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.RemoveItemCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , : line 1
PipelineIterationInfo : {}
vexx32 commentedon Mar 29, 2019
Hmm, sounds like someone might have messed with one of the resx strings there.
Does
$error[0].Exception.GetBaseException() | fl -fgive any additional information?Baribeault commentedon Mar 29, 2019
PS C:\Users\david> $error[0].Exception.GetBaseException() | fl -f
Message : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Data : {}
InnerException :
TargetSite : System.Text.StringBuilder AppendFormatHelper(System.IFormatProvider, System.String, System.ParamsArray)
StackTrace : at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object arg0)
at System.Management.Automation.Internal.StringUtil.Format(String formatSpec, Object o)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean
rootOfRemoval)
at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String path, Boolean recurse,
CmdletProviderContext context)
HelpLink :
Source : System.Private.CoreLib
HResult : -2146233033
vexx32 commentedon Mar 29, 2019
Looks like it should be from these three here, I'd venture to guess, and the resx strings used therein:
iSazonov commentedon Mar 29, 2019
We don't work with OneDrive well.
GregWoods commentedon Mar 2, 2020
Ubuntu shell works fine in a Windows OneDrive folder
rm -r
sba923 commentedon Apr 7, 2020
I confirm this issue is still there with PowerShell 7.0:
When this fails, the same
Remove-Item -Recurse -Forceoperation works in Windows PowerShell 5.1.sba923 commentedon Apr 24, 2020
Same as #11721
dgard1981 commentedon Jun 3, 2020
Is there a workaround here? This has been acknowledged as a bug for over a year with seemingly no movement.
iSazonov commentedon Jun 3, 2020
I guess it is not complex fix. I guess we need detect surrogate reparse points. If I remember correctly we already did this for read operations. Also I saw such code in .Net Core for Delete().
[DevOps] Return a success even when Clear-HD has issues.
17 remaining items
gatesvp commentedon Feb 3, 2021
[-]6.2.0-rc.1 Remove-Item -Recurse broken[/-][+]6.2.0-rc.1 Remove-Item -Recurse broken for reparse points[/+]SteveL-MSFT commentedon Jun 21, 2021
Ilya (@iSazonov) are you going to make another attempt to fix this?
iSazonov commentedon Jun 22, 2021
#15571 is waiting a code review.
sba923 commentedon Nov 23, 2021
Is this fixed in 7.2?
iSazonov commentedon Nov 23, 2021
I hope :-) Please install 7.2 and try to work with OneDrive.
sba923 commentedon Nov 23, 2021
I was at work when I got the notification so I thought I would just get the answer without testing 😝Of course 7.2 is on all my systems so I can test... And now I know I have to since there is no pre baked answer.
iSazonov commentedon Nov 24, 2021
You got :-) We push some commits to fix such issues and I hope now all works well. If you still see problems, feel free to report.
sba923 commentedon Nov 24, 2021
I think the answer is clear 😆
Good job!