Skip to content

File.Move relies on the UnixFileSystem CopyFile method that overwrites only when it shouldn't #14885

@ianhays

Description

@ianhays

The File.Move(source, dest) and FileInfo.MoveTo(dest) functions do not currently function as they should with regards to overwrites. The following test passes on Windows, but fails on Linux:

FileInfo testFileSource = new FileInfo(GetTestFilePath());
testFileSource.Create().Dispose();
FileInfo testFileDest = new FileInfo(GetTestFilePath());
testFileDest.Create().Dispose();
Assert.Throws<IOException>(() => File.Move(testFileSource.FullName, testFileDest.FullName)); // doesn't throw on Ubuntu

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions