Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7615637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:41:30+00:00 2026-05-31T02:41:30+00:00

I have a FileSystemWatcher set to check for new files, store the content in

  • 0

I have a FileSystemWatcher set to check for new files, store the content in a database and delete the files. About 10 days ago, it started to ignore some files. We’re talking about 1,500 files from a total of 50,000 files. By manually moving the files to a different directory and then moving them again to the watched directory, the files get noticed.

The InternalBufferSize is set to 32 kB to deal with large batches. It processes 300+ files at once without a problem, and reality isn’t even close to that.

The program was last touched over 40 days ago, for a change unrelated to the FileSystemWatcher. It’s been in production for over a year now. No spikes can be seen in the server load.

What can cause an issue like this one to suddenly appear? Is there a possibility that FileSystemWatcher is simply unreliable?

Edit
I’ve created a test where 1,000 files are created. After running it, 3,000 entries can be found in the event log. So I believe buffer overflow is out of the question?

    private void button1_Click(object sender, EventArgs e)
    {
        fsw = new FileSystemWatcher();
        fsw.Path = @"C:\temp\fsw-test";
        fsw.IncludeSubdirectories = false;
        fsw.NotifyFilter = NotifyFilters.FileName;
        fsw.Created += new FileSystemEventHandler(fsw_Created_handler);
        fsw.EnableRaisingEvents = true;
        fsw.InternalBufferSize = 32768;
        fsw.Error += fsw_Error_handler;
    }

    private void fsw_Created_handler(object sender, FileSystemEventArgs e)
    {
        new Thread(new ParameterizedThreadStart(work)).Start(e);
    }

    private void fsw_Error_handler(object sender, ErrorEventArgs e)
    {
        EventLog.WriteEntry("few test", e.GetException().Message);
    }

    private void work(object e)
    {
        try
        {
            EventLog.WriteEntry("fsw test", "Queueing File Started");
            Thread.Sleep(10000);
            EventLog.WriteEntry("fsw test", ((FileSystemEventArgs)e).Name);
            EventLog.WriteEntry("fsw test", "Queueing File Done");
        }
        catch (Exception ex)
        {
            EventLog.WriteEntry("fsw test", "Error = " + ex.StackTrace + " *** " + ex.ToString());
        }
    }

    private void button2_Click(object sender, EventArgs e)
    {
        for (int i = 1; i <= 1000; i++)
        {
            System.IO.File.Create(@"C:\temp\fsw-test\" + i);
        }
    }

Edit 2
Stress testing the program in multiple ways and checking the code over and over again revealed no issues. So right now it’s an unreproducible bug, I’ll do a few changes to make it log more frequently and monitor the situation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:41:31+00:00Added an answer on May 31, 2026 at 2:41 am

    The problem turned out to be a Queue corruption, caused by multi-threading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have several .NET applications that monitor a directory for new files, using FileSystemWatcher.
I have a set of files and I would like to monitor them for
I have a program that needs to retrieve some data about a set of
I have a simple app using FileSystemWatcher running as a Windows Service. Files are
I have a FileSystemWatcher that processes files based on file system events. After awhile,
I am about to implement the archetypal FileSystemWatcher solution. I have a directory to
I have a project that uses the .net FileSystemWatcher to watch a Samba network
We have an asp.net mvc application that we would like to integrate a FileSystemWatcher
Is it possible to implement Delegate methods for FileSystemWatcher? I have a delegate method
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.