/// <summary> /// <b>Defensively</b> invokes the supplied <paramref name="sink"/>, passing the /// supplied <paramref name="arguments"/> to the sink. /// </summary> /// <param name="sink">The sink to be invoked.</param> /// <param name="arguments">The arguments to the sink.</param> /// <param name="exceptions">the map of sink/exception entries to add any exception to</param> protected override void Invoke(Delegate sink, object[] arguments, EventExceptionsCollector exceptions) { try { sink.DynamicInvoke(arguments); } catch (Exception ex) { Log.Warn("Error during raising an event from " + new StackTrace(), ex); exceptions.Add(sink, ex); } }
/// <summary> /// <b>Defensively</b> invokes the supplied <paramref name="sink"/>, passing the /// supplied <paramref name="arguments"/> to the sink. /// </summary> /// <param name="sink">The sink to be invoked.</param> /// <param name="arguments">The arguments to the sink.</param> /// <param name="exceptions">the map of sink/exception entries to add any exception to</param> protected override void Invoke(Delegate sink, object[] arguments, EventExceptionsCollector exceptions) { try { sink.DynamicInvoke (arguments); } catch(Exception ex) { Log.Warn("Error during raising an event from " + new StackTrace(), ex); exceptions.Add(sink, ex); } }
/// <summary> /// Invokes the supplied <paramref name="sink"/>, passing the supplied /// <paramref name="arguments"/> to the sink. /// </summary> /// <param name="sink">The sink to be invoked.</param> /// <param name="arguments">The arguments to the sink.</param> /// <param name="exceptions">the map of sink/exception entries to add any exception to</param> protected virtual void Invoke(Delegate sink, object[] arguments, EventExceptionsCollector exceptions) { try { sink.DynamicInvoke(arguments); } catch (TargetInvocationException ex) { // unwrap the exception that actually caused the TargetInvocationException and throw that... Exception cause = ReflectionUtils.UnwrapTargetInvocationException(ex); exceptions.Add(sink, cause); throw cause; } }
/// <summary> /// Invokes the supplied <paramref name="sink"/>, passing the supplied /// <paramref name="arguments"/> to the sink. /// </summary> /// <param name="sink">The sink to be invoked.</param> /// <param name="arguments">The arguments to the sink.</param> /// <param name="exceptions">the map of sink/exception entries to add any exception to</param> protected virtual void Invoke(Delegate sink, object[] arguments, EventExceptionsCollector exceptions) { try { sink.DynamicInvoke (arguments); } catch (TargetInvocationException ex) { // unwrap the exception that actually caused the TargetInvocationException and throw that... Exception cause = ReflectionUtils.UnwrapTargetInvocationException(ex); exceptions.Add(sink, cause); throw cause; } }