We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All these methods and properties throw an exception e.g. if the file is not found:
File.GetCreationTime[Utc] File.GetLastAccessTime[Utc] Directory.GetCreationTime[Utc] Directory.GetLastAccessTime[Utc] Directory.GetLastWriteTime[Utc] FileSystemInfo.CreationTime[Utc] FileSystemInfo.LastAccessTime[Utc] FileSystemInfo.LastWriteTime[Utc]
But File.GetLastWriteTime[Utc] does not; it catches all exceptions and returns a default date (DateTime.FromFileTimeUtc(0L)). This is inconsistent.
File.GetLastWriteTime[Utc]
DateTime.FromFileTimeUtc(0L)
The text was updated successfully, but these errors were encountered:
Just checked the behavior of System.IO: none of these methods and properties throw an exception.
The behavior in LongPath makes more sense IMO, but it should be made consistent.
Sorry, something went wrong.
96d389c
Merge pull request #23 from thomaslevesque/issue22
a20d504
Do not catch exception in File.GetLastWriteTimeUtc (fix #22)
I just noticed two unit tests that specifically check that GetLastWriteTime does not throw on a file that doesn't exist:
GetLastWriteTime
FileTests.TestGetLastWriteTimeOnMissingFileHasNoException
UncFileTests.TestGetLastWriteTimeOnMissingFileHasNoException
These tests should probably be removed...
No branches or pull requests
All these methods and properties throw an exception e.g. if the file is not found:
But
File.GetLastWriteTime[Utc]
does not; it catches all exceptions and returns a default date (DateTime.FromFileTimeUtc(0L)
). This is inconsistent.The text was updated successfully, but these errors were encountered: