This project is read-only.

Exception Message

Mar 13, 2014 at 10:52 PM
I am using AlphaFS in an application which scans several thousand files. When files are not found, the app logs an entry to a log file which includes the exception message text. After running the app for several hours, I noticed a log entry that was over 2.7 million characters long. The exception message seems to include previous file names.

I tried creating a test app to reproduce the issue, but was not successful. Does anyone know what could be causing this?

Here's a truncated version of one of the messages. Notice the multiple file names.
The system cannot find the file specified. (Exception from HRESULT: 0x80070002): [M:\Bereichsleitung\5 Regnet\Personenbez Themen\Leitner\EWE\EWE_9.txt]: [M:\Bereichsleitung\5 Regnet\Personenbez Themen\Leitner\EWE\EWE_9.txt]: [M:\Studenten\Mitarbeiter A-Z\Lips\Studentenbestand\Studaus1-5 v 20110801\Studaus1.txt]: [M:\Studenten\Mitarbeiter A-Z\Lips\Studentenbestand\Studaus1-5 v 20110801\Studaus2.txt]: [M:\Studenten\Mitarbeiter A-Z\Lips\Studentenbestand\Studaus1-5 v 20110801\Studaus3.txt]: [M:\Studenten\Mitarbeiter A-Z\Lips\Studentenbestand\Studaus1-5 v 20110801\Studaus4.txt]: [M:\Studenten\Mitarbeiter A-Z\Lips\Studentenbestand\Studaus1-5 v 20110801\Studaus5.txt]: [G:\VZB\Controlling\Vertriebszahlen\aktuelle Datenbanken ab 12-2007\Daten BST\Datenimport 2009\Datenimport BST 2009 vom 24102009.xls]: 
Mar 14, 2014 at 8:25 AM
2.7 million characters long? Wow, talk about "pathtoolong"

Which AlphaFS methods are involved?

Mar 14, 2014 at 12:22 PM
It was not the path that was that long, but the exception message. It's difficult to say what methods were involved, but the app pretty much just uses basic methods such as File.Open or File.Exists. It constructs a file path based on links found within a document. Some of these links are not valid file paths and could possibly be the reason why this is happening. Is there anything in AlphaFS that would be retaining file names? The exception message seems to be outputting from some kind of collection.
Mar 14, 2014 at 4:32 PM

This issue occurs with short file paths using AlphaFS. I was not able to reproduce it using Win7, but it has occurred on Server 2003 and Server 2008 R2. The file name is appended to the end of the exception message which seems to already include previous file names. Very odd.
Mar 14, 2014 at 10:32 PM
In file: NativeError.cs at line 97:
throw new FileNotFoundException(FormatError(e.Message, readPath ?? writePath));
you could change this to:
throw new FileNotFoundException(FormatError(e.Message, null));
to see how it would behave now.