Timer swallowing events in .NET 2.0

Despite the documentation implying that exceptions on threads will propogate and terminate it is not always true. We have just spent time chasing behaviour that did not match this expectation with System.Timers.Timer. It turns out the System. Timers.Timer swallows exceptions and System.Threading.Timer propogates them. Jean Paul S. Boodhoo has the skinny on this one. He also used reflector to show up the offending line of code. Something we might want to make sure gets added to the documentation I think.
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

12 Responses to Timer swallowing events in .NET 2.0

  1. Tom says:

    Perhaps you could add this info to the MSDN Wiki page for System.Timers.Timer ?

  2. peter says:

    Thanks for that one, I\’ve never used System.Timers.Timer mostly \’cos a certain Mr J Richter says not to the bother.
    He recommends either System.Threading or Windows.Forms variants, I suspect the reason it swallows exceptions is it\’s supposed to go onto design surfaces.

  3. Ian Cooper says:

    Thanks for the prompt Tom. I\’ll get on it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s