dotnet / dotnet/dotnet-api-docs
APIs that throw PathTooLongException may sometimes throw DirectoryNotFoundException
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
Not sure the best way to handle/track this. .NET Core doesn't preemptively check for path lengths anymore (as it is impossible to accurately predict). We throw PathTooLong when the OS reports it. In most cases that means behavior stays the same, but in some rare cases you can get DirectoryNotFound instead of PathTooLong.
I give a somewhat detailed description here: https://github.com/dotnet/corefx/issues/24567#issuecomment-335936074
It may be enough to just make sure that all APIs that have PathTooLong also have DirectoryNotFound. We may also want to consider mentioning that in exceptional cases long paths can return DirectoryNotFound.
If there is a better way to reflect this behavior I'm open to suggestions.
Contributor guide
Assessment
This issue has not been assessed yet.