Skip to content

Unable to delete OneDrive-tracked directories with Remove-Item #11721

Closed

Description

@rjmholt

See #11331.

Steps to reproduce

remove-item -force -recurse ./dir

Expected behavior

Folder is deleted

Actual behavior


ProviderInvocationException :
    ProviderInfo   : Microsoft.PowerShell.Core\FileSystem
    ErrorRecord    :
        Exception             :
            TargetSite :
                Name          : AppendFormatHelper
                DeclaringType : System.Text.StringBuilder
                MemberType    : Method
                Module        : System.Private.CoreLib.dll
            StackTrace :
   at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   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)
            Message    : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
            Source     : System.Private.CoreLib
            HResult    : -2146233033
        CategoryInfo          : InvalidOperation: (:) [], FormatException
        FullyQualifiedErrorId : RemoveItemProviderException
    Message        : Attempting to perform the RemoveItem operation on the 'FileSystem' provider failed for path 'C:\Users\roholt\OneDrive - Microsoft\Dev\PowerShellEditorServices\module\PowerShellEditorServices\bin'. Index (zero based) must be greater than or equal to zero and less than the size of the argument
list.
    TargetSite     :
        Name          : RemoveItem
        DeclaringType : System.Management.Automation.SessionStateInternal
        MemberType    : Method
        Module        : System.Management.Automation.dll
    StackTrace     :
   at System.Management.Automation.SessionStateInternal.RemoveItem(CmdletProvider providerInstance, String path, Boolean recurse, CmdletProviderContext context)
   at System.Management.Automation.SessionStateInternal.RemoveItem(String providerId, String path, Boolean recurse, CmdletProviderContext context)
   at Microsoft.PowerShell.Commands.RemoveItemCommand.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
    InnerException :
        TargetSite :
            Name          : AppendFormatHelper
            DeclaringType : System.Text.StringBuilder
            MemberType    : Method
            Module        : System.Private.CoreLib.dll
        StackTrace :
   at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   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)
        Message    : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
        Source     : System.Private.CoreLib
        HResult    : -2146233033
    Source         : System.Management.Automation
    HResult        : -2146233087
ProviderInfo                : Microsoft.PowerShell.Core\FileSystem
ErrorRecord                 :
    Exception             :
        TargetSite :
            Name          : AppendFormatHelper
            DeclaringType : System.Text.StringBuilder
            MemberType    : Method
            Module        : System.Private.CoreLib.dll
        StackTrace :
   at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   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)
        Message    : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
        Source     : System.Private.CoreLib
        HResult    : -2146233033
    CategoryInfo          : NotSpecified: (:) [Remove-Item], FormatException
    FullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.RemoveItemCommand
    InvocationInfo        :
        MyCommand        : Remove-Item
        ScriptLineNumber : 1
        OffsetInLine     : 1
        HistoryId        : 34
        Line             : Remove-Item "$root/module/PowerShellEditorServices/bin" -Recurse -Force -Verbose
        PositionMessage  : At line:1 char:1
                           + Remove-Item "$root/module/PowerShellEditorServices/bin" -Recurse -For …
                           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        InvocationName   : Remove-Item
        CommandOrigin    : Internal
    ScriptStackTrace      : at <ScriptBlock>, C:\Users\roholt\OneDrive - Microsoft\Dev\PowerShellEditorServices\PowerShellEditorServices.build.ps1: line 127
                            at *Task, C:\Users\roholt\Documents\PowerShell\Modules\InvokeBuild\5.4.1\Invoke-Build.ps1: line 526
                            at <ScriptBlock><End>, C:\Users\roholt\Documents\PowerShell\Modules\InvokeBuild\5.4.1\Invoke-Build.ps1: line 684
                            at <ScriptBlock>, <No file>: line 1
    PipelineIterationInfo :



TargetSite                  :
    Name          : Invoke
    DeclaringType : System.Management.Automation.Runspaces.PipelineBase
    MemberType    : Method
    Module        : System.Management.Automation.dll
StackTrace                  :
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.InvokeWithDebugger(IEnumerable`1 input, IList`1 output, PSInvocationSettings settings, Boolean invokeMustRun)
   at System.Management.Automation.ScriptDebugger.ProcessCommand(PSCommand command, PSDataCollection`1 output)
   at Microsoft.PowerShell.ConsoleHost.InputLoop.ProcessDebugCommand(String cmd, Exception& e)
Message                     : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Data                        : System.Collections.ListDictionaryInternal
InnerException              :
    TargetSite :
        Name          : AppendFormatHelper
        DeclaringType : System.Text.StringBuilder
        MemberType    : Method
        Module        : System.Private.CoreLib.dll
    StackTrace :
   at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   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)
    Message    : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
    Source     : System.Private.CoreLib
    HResult    : -2146233033
Source                      : System.Management.Automation
HResult                     : -2146233087

Environment data


Name                           Value
----                           -----
PSVersion                      7.0.0-rc.2
PSEdition                      Core
GitCommitId                    7.0.0-rc.2
OS                             Microsoft Windows 10.0.19535
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Jan 29, 2020
  2. added
    Issue-BugIssue has been identified as a bug in the product
    and removed
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Jan 30, 2020
  3. iSazonov commented on Jan 30, 2020

    @iSazonov
    Collaborator

    .Net Core behavior dotnet/corefx#28124

  4. added
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Jan 30, 2020
  5. iSazonov commented on Apr 24, 2020

    @iSazonov
    Collaborator

    Dup #9246

  6. added and removed
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Jun 21, 2021
  7. ghost closed this as completedon Jun 22, 2021
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-DuplicateThe issue is a duplicate.WG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions