Closed thomaslevesque closed 9 years ago
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.
I just noticed two unit tests that specifically check that GetLastWriteTime
does not throw on a file that doesn't exist:
FileTests.TestGetLastWriteTimeOnMissingFileHasNoException
UncFileTests.TestGetLastWriteTimeOnMissingFileHasNoException
These tests should probably be removed...
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.