Behavior of events when one event handler triggers an exception

  • Thread starter Thread starter gs_sarge
  • Start date Start date
G

gs_sarge

Hi:

I'm trying to figure out the behavior of an event when one of the
event handlers triggers an exception.

In my case, I'm using events so the server can contact the client
using Remoting.

Each client registers its own event handler for the servers event.

Hower, if one of the client connections is broken unexpectedly,
calling the event triggers an exception, since the connection has been
lost.

Will that exception prevent the other event handlers in line from
getting notified?


If so, is there any way to purge the suspected faulty event handler?

Unfortunately, the exception I get (System.Net.WebException) doesn't
have much information as to which event handler triggered it.

Any ideas on this would be very helpful

Thanks
 
Hi GS,
I'm trying to figure out the behavior of an event when one of the
event handlers triggers an exception.

In my case, I'm using events so the server can contact the client
using Remoting.

Each client registers its own event handler for the servers event.

Hower, if one of the client connections is broken unexpectedly,
calling the event triggers an exception, since the connection has been
lost.

Will that exception prevent the other event handlers in line from
getting notified?

From what I know, the event handlers will be called in the sequence that
they registered. That means if there are 100 clients, 100 sequential and
probably synchronous event calls are made. I can't tell you anything about
the exception but it shouldn't be hard to find that out. Register to clients
with as event handlers, kill the first one and raise the event. If the
second gets the event, you're fine, if not, you're in trouble.

Here is another idea: What if you create your own "event" mechanism? Clients
register a call-back function. The server keeps those in an ArrayList and
performs the calls manually. This way you have full control over exceptions,
plus you could make asynchronous calls that perform virtually parallel.

CU Christoph
 
Back
Top