Besides checking out the internalbuffersize stuff, you may want to think about how you are processing the files. Since you said that by commenting out process procedure it sees all the files, it sounds like the buffer is overflowing because the events are not finishing up fast enough to keep that internal buffer open. It would probably make more sense in the created event to simply add the file name (or file object) to a queue object, so the thread that raised the event can be returned to the pool for the other events waiting in the buffer. Then in another thread of your making (or a pool) retrieve the files off the queue and run your process procedure. This way you will not use the thread from the filesystemwatcher to also run you (long running?) process code, it is instead decoupled and handled by your own threads.
Justin Harrell Vice President Development Aciss Systems Inc. -----Original Message----- From: Don Davis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 12:19 PM To: [EMAIL PROTECTED] Subject: [DOTNET] Problem with Service and File System Watcher Hello all. Relatively new to the realm of Net and C# so please excuse any greenhorn practices. Having trouble with a Service we wrote (c#) which incorporates the File System Watcher. Service is setup to watch for "created" files only. All files are small text files. Each file is opened and "processed". Processing involves reading through the file to determine some header info which is then used to insert/update a table in SQL. Service works fine until we dump 50+ files into the watched "Path" directory. At this point it will process a varied number of files. Sometimes 1 or 2, sometimes half, rarely all and then appears to "stop" or "miss the remaining files". I have put all code in a try catch to write any error to the event log. Nothing is written to the log. Originally thought that the service was getting the event that the file was created but couldn't "open" the file. If that's the case I thought I would see an error. No errors. Wrote a routine to test to open the file and return the filestream anyway. Still no errors. If i comment out the line that calls our "Process" routine, then all files are "seen" Any suggestions would be appreciated. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.