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

  • SEARCH
  • Home
  • 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 9281967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:15:11+00:00 2026-06-18T18:15:11+00:00

I was recently testing with some FileSystemWatcher s and wonder how the event handling

  • 0

I was recently testing with some FileSystemWatchers and wonder how the event handling works in .NET. For example, with this code in VB.NET:

Dim fsw1, fsw2, fsw3 As New FileSystemWatcher()

Private Sub fsw_Error(sender As Object, e As ErrorEventArgs) _
                                 Handles fsw1.Error, fsw2.Error, fsw3.Error
    Dim iCont As Integer = 1
    Dim fsw As FileSystemWatcher = CType(sender, FileSystemWatcher)

    While Not fsw.EnableRaisingEvents AndAlso iCont < 120
        iCont += 1

        Try
            fsw.EnableRaisingEvents = True
            txtResultado.Clear()
        Catch
            fsw.EnableRaisingEvents = False
            Threading.Thread.Sleep(30000)
        End Try
    End While
End Sub

Each time an error occurs on any of the FileSystemWatchers the function is executed. A different thread for the function is generated for each FileSystemWatcher? Can they interfere with each other while executing more than one at the same time?

There is maybe a difference between C# and VB.NET in this?

  • 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-06-18T18:15:12+00:00Added an answer on June 18, 2026 at 6:15 pm

    There are no constraints for which thread calls an event; if you feel like calling an event in another thread, you are free to do so in .NET. To be honest I cannot imagine implementing a FileSystemWatcher without using a separate thread or async IO for the watcher (which calls the event if a change is found), because you don’t want the events to interrupt the normal flow of the application.

    Events in .NET work with an invocation list which is called when the event is raised. When invoking an event, the invocation list is walked and each method is called, in a single thread. Simple as that.

    The functionality is .NET functionality so the same for both C# and VB.Net

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

Sidebar

Related Questions

I recently did some performance testing and analysis of an ASP.NET application using out-of-process
I've recently come across some unit testing code that imports the modules to test
Recently I read some articles about some doubts about benefits of acceptance testing, because
I recently ran some penetration testing software on my web site and was surprised
I've recently deployed some A/B testing experiments using vanity to my heroku instance. However,
I'm currently finishing up testing a new Ruby on Rails app. Just recently, some
I was recently reading a question here (some time this week), which I can't
I've recently decided to start using some light unit testing to see if it
I've recently been pushing some ASP.NET MVC 3 and 4 sites to IIS 7
I had this problem a long time ago and recently I got some clues

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.