all groups > dotnet remoting > september 2006 >
You're in the

dotnet remoting

group:

What happens to an exception thrown in asyncronous call.


What happens to an exception thrown in asyncronous call. Douglas Peterson
9/26/2006 7:38:54 PM
dotnet remoting:
So I have this (singleton) remote object. It has a delegate for a data
change event:
public delegate void DataChangeEvent();

When the client(s) connect to the object, they add themselves as listeners
to the event:
remoteObject.dataChangeListeners += new DataChangeEvent(some function);

When dispatching the event I have the object do the following:
if (dataChangeListeners != null)
foreach (DataChangeEvent dce in dataChangeListeners.GetInvocationList())
dce.BeginInvoke(null, null);

I did it in this way because a) I don't care if this notice is received by
the clients or not, and b) I want the object to continue going about its
business, not waiting around to find out if the call completed or not.

Then I wondered: What happens if an exception is thrown by the client code
while processing the event call? I'm not clear about how asyncronous calls
are made in the framework, let alone asyncronous calls made across a TCP
connection.

So I tried it out and.. nothing happens. No exception seems to go unhandled
anywhere. There's no trace output in the debugger, no dialog boxes pop up,
no notice of threads terminating, nothing; but the code after the throw does
not execute (i.e. it IS getting thrown). I don't have any exception handlers
anywhere (client or server) that silently trap an exception.

So where is this exception going? Who's handling it? Who's supposed to
handle it?

Re: What happens to an exception thrown in asyncronous call. Spam Catcher
9/27/2006 5:29:28 PM
"Douglas Peterson" <Tergiver@nospam.msn.com> wrote in news:upkVvTc4GHA.1200
@TK2MSFTNGP02.phx.gbl:

[quoted text, click to view]

The exception is raised in the callback handler - so in your case, you need
AddThis Social Bookmark Button