private async Task RunAndRescheduleNoThrow()
        {
            try
            {
                var logger = new SynchronizationLogger(_profileId, _profileName);

                using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Running synchronization profile '{0}'", _profileName)))
                {
                    await _synchronizer.SynchronizeNoThrow(logger);
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                var synchronizationReport = logger.GetReport();
                _synchronizationReportRepository.AddReport(synchronizationReport);
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.HandleException(x, s_logger);
            }
            finally
            {
                _lastRun = DateTime.UtcNow;
            }
        }
 public void AddReport(SynchronizationReport report)
 {
     if (report.HasErrors ||
         AcceptAddingReportsWithJustWarnings && report.HasWarnings ||
         AcceptAddingReportsWithoutWarningsOrErrors)
     {
         _inner.AddReport(report);
     }
 }
        private void SaveAndShowReport(SynchronizationReport report)
        {
            if (report.HasErrors ||
                _logReportsWithJustWarnings && report.HasWarnings ||
                _logReportsWithoutWarningsOrErrors)
            {
                var reportName = _synchronizationReportRepository.AddReport(report);

                if (IsReportsViewVisible)
                {
                    ShowReportsImplementation(); // show to bring it into foreground
                    return;
                }

                var hasErrors   = report.HasErrors;
                var hasWarnings = report.HasWarnings;

                if (hasErrors || hasWarnings)
                {
                    if (hasWarnings && _showReportsWithWarningsImmediately ||
                        hasErrors && _showReportsWithErrorsImmediately)
                    {
                        ShowReportsImplementation();
                        var reportNameAsString = reportName.ToString();
                        _currentReportsViewModel.SelectReportByName(reportNameAsString);
                        return;
                    }

                    var handler = SynchronizationFailedWhileReportsFormWasNotVisible;
                    if (handler != null)
                    {
                        handler(this, EventArgs.Empty);
                    }
                }
            }
        }