The FileSystemWatcher buffer is overflowing.  You can handle this event
by adding something like this to your code that sets of the
FileSystemWatcher:

// ProcessOverflow is a method setup to handle FSW buffer overflows.
fsw.Error += new ErrorEventHandler(ProcessOverflow);

See MSDN for FileSystemWatcher.Error event for more info.

-----Original Message-----
From: The DOTNET list will be retired 7/1/02
[mailto:[EMAIL PROTECTED]] On Behalf Of Don Davis
Sent: Wednesday, June 12, 2002 9:19 AM
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.

Reply via email to