public static void InvokeSafe(this Action action) { if (action == null) { return; } foreach (Action a in action.GetInvocationList()) { try { a(); } catch (Exception exn) { UnhandledExceptionWatcher.Swallow(exn); } } }
private void NotifyOnCompleted() { if (PrivateCompleted != null) { foreach (Action cb in PrivateCompleted.GetInvocationList()) { try { cb(); } catch (Exception exn) { UnhandledExceptionWatcher.Swallow(exn); } } PrivateCompleted = null; } }
public static void InvokeSafe <T1, T2>(this Action <T1, T2> action, T1 p1, T2 p2) { if (action == null) { return; } foreach (Action <T1, T2> a in action.GetInvocationList()) { try { a(p1, p2); } catch (Exception exn) { UnhandledExceptionWatcher.Swallow(exn); } } }