Exemplo n.º 1
0
        // Token: 0x06000E0C RID: 3596 RVA: 0x00054E78 File Offset: 0x00053078
        protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession;

            if (mailboxSession == null)
            {
                return;
            }
            if (mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.UserMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.LinkedMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.GroupMailbox)
            {
                CalendarRepairAssistant.CachedStateTracer.TraceDebug <Guid, string, string>((long)this.GetHashCode(), "Skipping mailbox with guid {0} and display name {1} since this is a {2} and not a UserMailbox or a LinkedMailbox", mailboxSession.MailboxGuid, mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.RecipientTypeDetails.ToString());
                return;
            }
            ExDateTime  now         = ExDateTime.Now;
            ExDateTime  rangeStart  = now.AddDays((double)(-(double)this.RepairPolicy.DaysInWindowBackward));
            ExDateTime  rangeEnd    = now.AddDays((double)this.RepairPolicy.DaysInWindowForward);
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mailboxSession.MailboxGuid);
            bool        flag        = ResourceCheck.DetailedCheckForAutomatedBooking(mailboxSession, cachedState);

            if (flag)
            {
                CalendarRepairAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: Calendar Repair Assistant is skipping resource mailbox.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            CalendarRepairAssistantLogEntry calendarRepairAssistantLogEntry = new CalendarRepairAssistantLogEntry
            {
                DatabaseGuid   = mailboxSession.MailboxOwner.MailboxInfo.GetDatabaseGuid(),
                MailboxGuid    = mailboxSession.MailboxGuid,
                TenantGuid     = mailboxSession.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid(),
                RepairMode     = this.RepairPolicy.RepairMode.ToString(),
                RangeStartTime = string.Format("{0:O}", rangeStart.ToUtc()),
                RangeEndTime   = string.Format("{0:O}", rangeEnd.ToUtc())
            };

            this.MarkMailboxForUpgrade(mailboxSession, calendarRepairAssistantLogEntry);
            try
            {
                CalendarRepairAssistant.CachedStateTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Calendar Repair Assistant starting to validate mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName);
                CalendarValidator calendarValidator = CalendarValidator.CreateRepairingInstance(mailboxSession, rangeStart, rangeEnd, this.RepairPolicy, CalendarRepairAssistant.cvsPopulationTimeout);
                calendarValidator.OnItemInspected += this.incrementTotalItemsInspected;
                calendarValidator.OnItemRepaired  += this.incrementTotalItemsRepaired;
                List <MeetingValidationResult> validationResults = calendarValidator.Run();
                calendarValidator.OnItemInspected -= this.incrementTotalItemsInspected;
                calendarValidator.OnItemRepaired  -= this.incrementTotalItemsRepaired;
                calendarRepairAssistantLogEntry.AddValidationResults(validationResults);
                CalendarRepairLogger.Instance.Log(validationResults, mailboxSession.MailboxOwner, rangeStart, rangeEnd);
                if (CalendarRepairAssistant.IsCRAReliabilityLoggerEnabled(mailboxSession))
                {
                    CalendarReliabilityInsigntLogger.Instance.Log(calendarRepairAssistantLogEntry, validationResults);
                }
                CalendarRepairAssistant.CachedStateTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Calendar Repair Assistant completed validating mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName);
            }
            catch (WrongServerException ex)
            {
                string message = string.Format("Could not access the mailbox (ExchangePrincipal:'{0}'). Exception: {1}.", mailboxSession.MailboxOwner, ex);
                CalendarRepairAssistant.Tracer.TraceDebug((long)this.GetHashCode(), message);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex);
            }
            catch (MailboxUserNotFoundException ex2)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <MailboxUserNotFoundException>((long)this.GetHashCode(), "MailboxUserNotFoundException:{0}", ex2);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex2);
            }
            catch (CorruptDataException ex3)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <CorruptDataException>((long)this.GetHashCode(), "CorruptDataException:{0}", ex3);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex3);
            }
            catch (SubmissionQuotaExceededException ex4)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <SubmissionQuotaExceededException>((long)this.GetHashCode(), "SubmissionQuotaExceededException:{0}", ex4);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex4);
            }
            catch (StoragePermanentException ex5)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <StoragePermanentException>((long)this.GetHashCode(), "StoragePermanentException:{0}", ex5);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex5);
            }
            catch (Exception ex6)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "Exception:{0}", ex6);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex6);
                throw ex6;
            }
            finally
            {
                stopwatch.Stop();
                calendarRepairAssistantLogEntry.TotalProcessingTime = stopwatch.Elapsed.TotalMilliseconds.ToString();
                customDataToLog.AddRange(calendarRepairAssistantLogEntry.FormatCustomData());
            }
        }