My application reads a text file in, removes any trailing spaces from each line in ths file and writes it out to a text file. Simple enough I thought. The user has encountered this criptic message and I have no ideas as to it's source nor how to correct it. Is this error from my code or did the system 'hiccup' and interupt the process
The Dialog title is: File Trimmer.exe - Common Language Runtime Debugging Services
The body of the message:
Application has generated an exception that could not be handled.
Process id=0x914(2324), Thread id=0xf58(3928).
Click OK to terminate the application.
Click CANCEL to debug the application.
I've tried to locate where this may have occured to no avail. I've double-checked and I have try/catch in all methods that do any file processing.
This is very puzzleing. Does anyone have a clue
Thank you.

How do I code for this?
zr119_62
Do you have the document that was being processed when the error occurred Can you reproduce it
Being able to step through this with the debugger would be helpful.
- Charlie
MattJGrant
- Has EOL condition been done before processing. (This is dependent on how the code is doing the processing, since the code was not provided I must put this in.)
- Has the line read been checked to see if it actually has information by calling if (string.IsNullOrEmpty(<line>) == false) { ... do processing ... }.
- Instead of processing the file line by line, read the file into a buffer and use Regex.Replace do the work over the whole how file. That limits possible problems to file open, regex processing and file close.
- File may be opened and locked by another process, saving could cause a problem.
- If using streams, make sure to check for null streams or file handles...
- Try/catch around file open and close as well.
Just some thoughts...good luck.TimoWo
I found the problem. Thank you for your help. I couldn't duplicate the problem at all. I finally went to our security dept and found that this was caused when an instance of the app was "untrusted". I found out the user was new to the system and had to process the file for another person. I walked them thru the process to set the app to be "trusted" on their machine and all is well.
I should've thought about that first, this hasn't happened in a long while and I had forgotten all about the untrusted application issue.
Thank you all again, I really appreciate your help.