Behavior of events when one event handler triggers an exception

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
 
C

Christoph Wienands

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top