Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Directory.DeleteDirectory(): Method can get stuck in an infinite loop. #276

Closed
ardestan opened this issue Oct 13, 2016 · 8 comments
Closed
Assignees
Labels
Milestone

Comments

@ardestan
Copy link

Hi,
I have test that deletes nested folders on network drive, in Win7 and Server 2012 it works, but on XP it stuck, seems the method is not returning, probably an infinite loop.
I'm using the next method:
DeleteDirectory(string path, bool recursive), and I set the recursive argument to true.

@Yomodo
Copy link
Collaborator

Yomodo commented Oct 15, 2016

I may have found the culprit in code, if requireEmpty = false:

startRemoveDirectory:

case Win32Errors.ERROR_DIR_NOT_EMPTY:
    if (requireEmpty)
        throw new DirectoryNotEmptyException(pathLp);
    goto startRemoveDirectory;

Although I would expect the same behaviour on Windows 7 and Server 2012.
Nevertheless, a bug.

@ardestan
Copy link
Author

Is there different behavior between network and local directories?
According to the culprit, should expect the same behavior for local and network directories as well.

About Win7 and sever 2012:
In my tests, after deleting the nested directories, I'm cheking if deleted using Directory.Exists() method, so in Win7 and server 2012, The tests hit this code line.
So, apparently the method returned and those directories were deleted.

@Yomodo
Copy link
Collaborator

Yomodo commented Oct 16, 2016

The behavior should be the same for local and network drives.
The only thing behaving differently would be the Win32 API, but there's no mention of that in the docs.

@Yomodo Yomodo changed the title Delete folders on network drive in XP Directory.DeleteDirectory: Method can get stuck in infinite loop. Oct 16, 2016
@Yomodo Yomodo changed the title Directory.DeleteDirectory: Method can get stuck in infinite loop. Directory.DeleteDirectory(): Method can get stuck in an infinite loop. Oct 16, 2016
@Yomodo Yomodo added this to the Release 2.1.1 milestone Oct 16, 2016
@Yomodo Yomodo self-assigned this Oct 16, 2016
@Yomodo Yomodo closed this as completed in 93fbd67 Oct 16, 2016
@Yomodo
Copy link
Collaborator

Yomodo commented Oct 17, 2016

@ardestan I'm positive the issue is solved now. Could you perhaps test it?

@ardestan
Copy link
Author

Hi,
Sorry for the late rspond, i was in vacation
in the last 10 days.
where could i found the new dll?

@ardestan
Copy link
Author

Hi,
Did you released new dll (2.1.1) with your fixes?
I could not found such release.

@Yomodo
Copy link
Collaborator

Yomodo commented Oct 25, 2016

No, you'll have to compile this one your self. It has not been released yet.

@ardestan
Copy link
Author

ardestan commented Oct 26, 2016

Hi,

I'm using the last dev branch (version 2.1.1), now on XP it fails to delete nested folders on network path with the next message:
"Folder is not empty"
but on Win7 it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants