dotnet / dotnet/dotnet-api-docs

File.Copy(x, x, true) throws IOException, not documented

Open
#8,398 5 comments 0 reactions 0 assignees View on GitHub
area-System.IO Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

As written in the title, when using `System.IO.File.Copy(src, dest, true)` with `src = dest` and the (src/dest) file exists, it throws an IOException with message "The process cannot access the file '[...]' because it is being used by another process."

In this case, shouldn't the method just return instead of throwing an exception? I'd say this should at least be documented as the message is quite misleading ("another process").

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.