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 8940307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:00:16+00:00 2026-06-15T11:00:16+00:00

I have an event that is raised from a third-party library, which executes on

  • 0

I have an event that is raised from a third-party library, which executes on a background thread. This event basically notifies listeners of status updates in the system the library is watching. The handler invokes itself on the UI thread if InvokeRequired is true, and in either case then proceeds to append an entry for the status change to text in a textbox, and pop up a notification in the tray.

Now, the problem is that these status updates can come in very rapidly; the system being monitored can go from its “idle” state through several intermediates to a “ready” state in milliseconds. I need to know that the system has transitioned through all of these intermediate states; however, not all of the state changes are getting to the log. Setting a breakpoint and stepping through the handler shows the oddest behavior; the handler will step through the first couple of lines of code, and will then jump back to the method’s entry. It’s almost as if either the event or the Windows message pump is aborting the method call because another call to the same method is incoming. Putting the method body in a lock block does not solve it.

I’ve seen this before in other projects that do not use this third-party library. I wasn’t as concerned there, because the rapid-fire event was simply triggering window redraws. If they all happened, great, but if one was short-circuited, there was another in the pipe that would go through. This, however, is a much more application-critical task that must happen every time the event is raised, in order (it doesn’t have to happen as fast as the states actually change; definitely not expecting that).

What’s the cause of this short-circuiting behavior, and how do I stop it?

  • 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-15T11:00:17+00:00Added an answer on June 15, 2026 at 11:00 am

    Rather than doing all of the work synchronously in the thread the event handler fires in it would likely be beneficial to do the work in another thread.

    Just wrap everything you’re doing in your current event handler in a Task.Factory.StartNew, or use BeginInvoke to marshal to the UI thread instead of Invoke.

    I couldn’t be sure as I have no knowledge of that library, but it could be that it’s unable to fire more events until it finishes executing all of the event handlers for the previous event.

    Another option that you may need to do, either to solve this problem, or to prevent your UI from being mad at you for so many updates, is to take the status changes as the come in and just dump them into a collection, and then just periodically check that collection and process all of the changes in a batch. This would be easier on the event handler for the 3rd party object as it just needs to add an item to a collection, and also easier on the UI as it won’t need to update several times in the span of time the monitor can even render the changes.

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

Sidebar

Related Questions

Suppose I have a non-recurring event that needs to be raised X seconds from
I have a third-party editor that basically comprises a textbox and a button (the
I have a StatusChanged event that is raised by my object when its status
I have an event handler that will remove an element from a list of
I have built a component library that includes an executive class which does work
I have a window that is subscribing to an event that is raised by
I have a Form which listens to events that are raised elsewhere (not on
I have a class that raises an event with an error message. In some
I have a backend class that has to raise an event with no arguments.
I have event Button that creates text box in run time. Private Sub Button1_Click(ByVal

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.