How to catch an asynchronous delegate invocation exception?
The code:
---------------------------------------
String message = “my message”;
foreach( MyDelegate handler in m_MyDelegate.GetInvocationList() )
{
try
{
handler.BeginInvoke(message, null, null);
}
catch( System.Net.Sockets.SocketException exp )
{
m_MyDelegate -= handler;
}
}
---------------------------------------
Because I’m calling handler.BeginInvoke(), which is asynchronous invocation,
and not handler(message), which is synchronous invocation, the exception is
not arriving to my code and is not cough in my catch.
Is there a way so I will catch this exception in here?
--
Thanks
Sharon G.