-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.IOhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
When destination directory is invalid, Directory.Move() throws an exception claiming that parts of source directory does not exist.
Snippet:
using System.IO;
try
{
// cleanup
Directory.Delete("dst", true);
} catch {}
Directory.CreateDirectory("src");
Directory.Move("src", "dst/dst"); // dst/dst is nested and doesn't exist ; move failure
Current error message:
Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/dev/projects/test/src'.
$(String[] args) in /home/dev/projects/test/Program.cs:line 8
at System.IO.FileSystem.MoveDirectory(String sourceFullPath, String destFullPath)
at System.IO.Directory.Move(String sourceDirName, String destDirName)
at $.
I think the exception message should be something like: System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/dev/projects/test/dst/dst'.
I guess the error comes from here: https://github.com/microsoft/referencesource/blob/5697c29004a34d80acdaf5742d7e699022c64ecd/mscorlib/system/io/directory.cs#L1266
Configuration
.Net 5.0.102 - Ubuntu 20.4 - x64
Metadata
Metadata
Assignees
Labels
area-System.IOhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors