Skip to content

6.2.0-rc.1 Remove-Item -Recurse broken for reparse points #9246

Closed

Description

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

  • Remove-Item C:\Users\david\OneDrive\Documents\ -Recurse
  • CategoryInfo : NotSpecified: (:) [Remove-Item], FormatException
  • FullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.RemoveItemCommand

Activity

  1. powercode commented on Mar 29, 2019

    @powercode
    Collaborator

    David Baribeault (@Baribeault) Can you add the output of

    $error[0] | fl -showerror -force *
  2. Baribeault commented on Mar 29, 2019

    @Baribeault
    Author

    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 : {}

  3. vexx32 commented on Mar 29, 2019

    @vexx32
    Collaborator

    Hmm, sounds like someone might have messed with one of the resx strings there.

    Does $error[0].Exception.GetBaseException() | fl -f give any additional information?

  4. Baribeault commented on Mar 29, 2019

    @Baribeault
    Author

    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

  5. vexx32 commented on Mar 29, 2019

    @vexx32
    Collaborator

    Looks like it should be from these three here, I'd venture to guess, and the resx strings used therein:

    1. at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean
    rootOfRemoval)
    2. at Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)
    3. at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String path, Boolean recurse,
    CmdletProviderContext context)
    
  6. iSazonov commented on Mar 29, 2019

    @iSazonov
    Collaborator

    C:\Users\david\OneDrive\Documents\

    We don't work with OneDrive well.

  7. added
    WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
    on Mar 29, 2019
  8. GregWoods commented on Mar 2, 2020

    @GregWoods

    Ubuntu shell works fine in a Windows OneDrive folder
    rm -r

  9. sba923 commented on Apr 7, 2020

    @sba923
    Contributor

    I confirm this issue is still there with PowerShell 7.0:

    image

    When this fails, the same Remove-Item -Recurse -Force operation works in Windows PowerShell 5.1.

  10. sba923 commented on Apr 24, 2020

    @sba923
    Contributor

    Same as #11721

  11. dgard1981 commented on Jun 3, 2020

    @dgard1981

    Is there a workaround here? This has been acknowledged as a bug for over a year with seemingly no movement.

  12. added
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Jun 3, 2020
  13. iSazonov commented on Jun 3, 2020

    @iSazonov
    Collaborator

    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().

  14. 17 remaining items

  15. gatesvp commented on Feb 3, 2021

    @gatesvp
  16. removed
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Feb 20, 2021
  17. changed the title [-]6.2.0-rc.1 Remove-Item -Recurse broken[/-] [+]6.2.0-rc.1 Remove-Item -Recurse broken for reparse points[/+] on Feb 20, 2021
  18. SteveL-MSFT commented on Jun 21, 2021

    @SteveL-MSFT
    Member

    Ilya (@iSazonov) are you going to make another attempt to fix this?

  19. iSazonov commented on Jun 22, 2021

    @iSazonov
    Collaborator

    #15571 is waiting a code review.

  20. sba923 commented on Nov 23, 2021

    @sba923
    Contributor

    Is this fixed in 7.2?

  21. iSazonov commented on Nov 23, 2021

    @iSazonov
    Collaborator

    Is this fixed in 7.2?

    I hope :-) Please install 7.2 and try to work with OneDrive.

  22. sba923 commented on Nov 23, 2021

    @sba923
    Contributor

    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.

  23. iSazonov commented on Nov 24, 2021

    @iSazonov
    Collaborator

    I thought I would just get the answer without testing

    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.

  24. sba923 commented on Nov 24, 2021

    @sba923
    Contributor

    I think the answer is clear 😆

    image

    Good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions