Skip to content
New issue

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

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

Closed
mlsad3 opened this issue Nov 8, 2015 · 5 comments
Closed

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

mlsad3 opened this issue Nov 8, 2015 · 5 comments

Comments

@mlsad3
Copy link

mlsad3 commented Nov 8, 2015

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
Copy link
Author

mlsad3 commented Nov 8, 2015

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
Copy link
Author

mlsad3 commented Nov 8, 2015

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

@mlsad3
Copy link
Author

mlsad3 commented Nov 8, 2015

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
Copy link
Author

mlsad3 commented Nov 8, 2015

I forgot to mention that this is with the Nuget 1.3.2

@peteraritchie
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants