/// <summary> /// Used by the safe synchronization delegate. /// </summary> /// <param name="invocation">The invocation.</param> /// <param name="result">The result holder.</param> private static void InvokeSafely(IInvocation invocation, Result result) { if (result == null) { invocation.Proceed(); } else { try { invocation.Proceed(); result.SetValue(false, invocation.ReturnValue); } catch (Exception exception) { result.SetException(false, exception); } } }