peteraritchie / LongPath

drop-in library to support long paths in .NET
GNU Lesser General Public License v3.0
112 stars 43 forks source link

Exception from fileInfo.Exists when file does not exist #34

Closed mlsad3 closed 8 years ago

mlsad3 commented 8 years ago

I have the following exception sent in from a tester:

image

The filepath is ~160 characters and filename is another 60 characters, but the file does not exist. In fact, there's a good chance that the drive doesn't exist since this is my friend on a corporate computer with network drive.

Another thing I noticed is that fileInfo's createdTime and modifiedTime is much more sensitive (throws exceptions) when file does not exist verses the System.IO.FileInfo version. Not as important, I put a check first (if (fileInfo.Exists)), but now that throws exceptions too ;^)

mlsad3 commented 8 years ago

Here is the 'Exists' code that fails: var fileInfo = new FileInfo(sourceFile); if (fileInfo.Exists) { ... }

Another (besides createdTime and modifiedTime) that throws exceptions with Pri.LongPath is LastWriteTime.

mlsad3 commented 8 years ago

I ran a test with a fake filename, and 'exists' works as expected. I need to look into this more.

mlsad3 commented 8 years ago

The person has an 'H' drive that is mapped but is not connected. The file is nested inside this drive, and the path has been saved to DB. When Database is read, we check to see if the file exists. The drive is mapped, but not connected, so it should return 'False'. Instead it throws the above error. i.e. H:\Patent\Client\3582347 - (WH 7583) TestSubject\384572US03_2098\DRAFT\MyDraft v1.docx Where H:\ is mapped but not connected.

mlsad3 commented 8 years ago

I forgot to mention that this is with the Nuget 1.3.2

peteraritchie commented 8 years ago

Can't reproduce with the latest build. Assume it's fixed by other changes. Returns false now, not an exception.