// Token: 0x0600016F RID: 367 RVA: 0x00009B94 File Offset: 0x00007D94
 internal void Shutdown()
 {
     if (this.synchronizeTask != null)
     {
         try
         {
             if (!this.synchronizeTask.Wait(30000))
             {
                 this.cancellationTokenSource.Cancel();
                 this.synchronizeTask.Wait(30000);
             }
         }
         catch (AggregateException ex)
         {
             if (ex.InnerException != null)
             {
                 if (!(ex.InnerException is LocalizedException) && GrayException.IsGrayException(ex.InnerException))
                 {
                     ExWatson.SendReport(ex.InnerException, ReportOptions.None, null);
                 }
                 SearchEventLogger.Instance.LogFailedToSyncDiscoveryHoldToExchangeOnlineEvent(ex.InnerException);
             }
         }
         finally
         {
             if (this.synchronizeTask.IsCompleted)
             {
                 this.synchronizeTask.Dispose();
                 this.cancellationTokenSource.Dispose();
             }
             this.synchronizeTask         = null;
             this.cancellationTokenSource = null;
         }
     }
 }
            // Token: 0x06000038 RID: 56 RVA: 0x00003C00 File Offset: 0x00001E00
            protected override bool TryRunInternal(Action code, ref ExceptionHandler.ExceptionData args)
            {
                bool      retry     = false;
                bool      result    = false;
                Exception exception = null;

                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        try
                        {
                            code();
                            result = true;
                        }
                        catch (TransientException exception2)
                        {
                            retry     = true;
                            exception = exception2;
                        }
                        catch (LocalizedException exception3)
                        {
                            exception = exception3;
                        }
                    });
                }
                catch (GrayException exception)
                {
                    GrayException exception4;
                    exception = exception4;
                }
                args.ShouldRetry = retry;
                args.Exception   = exception;
                return(result);
            }
Beispiel #3
0
 internal static void UpdateSearchObject(IDiscoverySearchDataProvider dataProvider, DiscoverySearchBase searchObject)
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 dataProvider.CreateOrUpdate <DiscoverySearchBase>(searchObject);
             });
         }
         catch (DataSourceOperationException ex)
         {
             ExTraceGlobals.SearchTracer.TraceError <string, string>(0L, "UpdateSearchObject:Update Search failed for {0}. Root cause: {1}", searchObject.Name, ex.ToString());
             SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(searchObject.Name, dataProvider.OrganizationId.ToString(), ex);
         }
         catch (GrayException ex2)
         {
             ExTraceGlobals.SearchTracer.TraceError <GrayException>(0L, "UpdateSearchObject: GrayException {0} is thrown", ex2);
             SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(searchObject.Name, dataProvider.OrganizationId.ToString(), ex2);
         }
     }, delegate(object exception)
     {
         ExTraceGlobals.SearchTracer.TraceError(0L, "UpdateSearchObject: Unhandled exception {0}", new object[]
         {
             exception
         });
         SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(searchObject.Name, dataProvider.OrganizationId.ToString(), exception.ToString());
         return(!(exception is GrayException));
     });
 }
Beispiel #4
0
 private void SafeLog(Action logFunc)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             try
             {
                 logFunc();
             }
             catch (ArgumentException)
             {
             }
             catch (InvalidOperationException)
             {
             }
             catch (ReflectionTypeLoadException)
             {
             }
         });
     }
     catch (GrayException)
     {
     }
 }
		private ResponseMessageType[] ExecuteWebMethod(Func<BaseResponseMessageType> webMethodDelegate)
		{
			ExchangeService.Tracer.TraceDebug<ExchangeService, string>((long)this.GetHashCode(), "{0}: calling {1}", this, webMethodDelegate.Method.Name);
			BaseResponseMessageType response = null;
			int num = 0;
			for (;;)
			{
				Exception exception = null;
				try
				{
					GrayException.MapAndReportGrayExceptions(delegate()
					{
						ExchangeService.Tracer.TraceDebug<string>((long)this.GetHashCode(), "Calling {0}", webMethodDelegate.Method.Name);
						try
						{
							response = webMethodDelegate();
						}
						catch (SoapException exception)
						{
							SoapException exception = exception;
						}
						catch (WebException exception2)
						{
							SoapException exception = exception2;
						}
						catch (IOException exception3)
						{
							SoapException exception = exception3;
						}
						catch (InvalidOperationException exception4)
						{
							SoapException exception = exception4;
						}
					});
				}
				catch (GrayException ex)
				{
					ExchangeService.Tracer.TraceError<ExchangeService, string, GrayException>((long)this.GetHashCode(), "{0}: Failed request {1} with gray exception {2}", this, webMethodDelegate.Method.Name, ex);
					throw new UnexpectedRemoteDataException(ex);
				}
				if (exception == null)
				{
					goto IL_10A;
				}
				ExchangeService.Tracer.TraceError<ExchangeService, string, Exception>((long)this.GetHashCode(), "{0}: failed request {1} with exception {2}", this, webMethodDelegate.Method.Name, exception);
				if (num >= 3 || HttpWebRequestExceptionHandler.IsConnectionException(exception, ExchangeService.Tracer))
				{
					break;
				}
				num++;
			}
			throw new FailedCommunicationException(CS$<>8__locals2.exception);
			IL_10A:
			if (response == null || response.ResponseMessages == null || response.ResponseMessages.Items == null || response.ResponseMessages.Items.Length == 0)
			{
				ExchangeService.Tracer.TraceError<ExchangeService, string>((long)this.GetHashCode(), "{0}: received empty response from request {1}", this, webMethodDelegate.Method.Name);
				throw new UnexpectedRemoteDataException();
			}
			return response.ResponseMessages.Items;
		}
 private void LockAndExecuteOotyCallback(Action function)
 {
     lock (this.eventSyncLock)
     {
         try
         {
             function();
         }
         catch (Exception ex)
         {
             if (!(ex is RealTimeException) && !(ex is InvalidOperationException))
             {
                 if (!GrayException.IsGrayException(ex))
                 {
                     throw;
                 }
                 ExceptionHandling.SendWatsonWithoutDump(ex);
             }
             this.ErrorTrace("Error while processing audio call event received event. Exception:{0}", new object[]
             {
                 ex
             });
         }
     }
 }
Beispiel #7
0
 internal static void ExWatsonWrappedCall(ExWatson.MethodDelegate methodDelegate, ExWatson.MethodDelegate finallyDelegate)
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 methodDelegate();
             });
         }
         catch (GrayException arg)
         {
             SearchUtils.Tracer.TraceError <GrayException>(0L, "GrayException {0} is thrown", arg);
         }
         finally
         {
             finallyDelegate();
         }
     }, delegate(object exception)
     {
         SearchUtils.Tracer.TraceError(0L, "ExWatsonWrappedCall: Unhandled exception {0}", new object[]
         {
             exception
         });
         return(!(exception is GrayException));
     });
 }
        // Token: 0x06000067 RID: 103 RVA: 0x000030DC File Offset: 0x000012DC
        public override void Work()
        {
            AuditLogSearchHealthHandler instance             = AuditLogSearchHealthHandler.GetInstance();
            AuditLogSearchHealth        auditLogSearchHealth = instance.AuditLogSearchHealth;

            WaitHandle[] waitHandles = new WaitHandle[]
            {
                base.StopEvent,
                instance.RunSearchNowEvent
            };
            AuditLogSearchContext.EventLogger.LogEvent(MSExchangeAuditLogSearchEventLogConstants.Tuple_AuditLogSearchServiceletStarted, string.Empty, new object[]
            {
                this.pid
            });
            ExTraceGlobals.ServiceletTracer.TraceInformation(42415, (long)this.GetHashCode(), "AuditLogSearch servicelet starting");
            this.PublishNotification("AsyncSearchServiceletStarting", this.pid.ToString(), ResultSeverityLevel.Informational);
            AuditLogSearchServicelet.hbTimer.Elapsed += this.Callback;
            AuditLogSearchServicelet.hbTimer.Enabled  = true;
            for (;;)
            {
                int defaultDelay = this.ReadPollInterval();
                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        this.WorkInternal();
                    });
                }
                catch (GrayException ex)
                {
                    ExTraceGlobals.ServiceletTracer.TraceError(21863L, ex.ToString());
                    AuditLogSearchContext.EventLogger.LogEvent(MSExchangeAuditLogSearchEventLogConstants.Tuple_ServiceletException, string.Empty, new object[]
                    {
                        ex.ToString()
                    });
                    this.PublishNotification("AuditLogSearchCompletedWithErrors", ex.ToString(), ResultSeverityLevel.Error);
                    auditLogSearchHealth.AddException(ex);
                }
                int  millisecondsTimeout = this.retryPolicy.ProceedToNextIteration(defaultDelay);
                int  num  = WaitHandle.WaitAny(waitHandles, millisecondsTimeout, false);
                bool flag = num == 0;
                if (flag)
                {
                    break;
                }
                bool flag2 = num == 1;
                if (flag2)
                {
                    this.retryPolicy.Reset();
                }
            }
            AuditLogSearchServicelet.hbTimer.Enabled = false;
            AuditLogSearchContext.EventLogger.LogEvent(MSExchangeAuditLogSearchEventLogConstants.Tuple_AuditLogSearchServiceletEnded, string.Empty, new object[]
            {
                this.pid
            });
            ExTraceGlobals.ServiceletTracer.TraceInformation(28310, (long)this.GetHashCode(), "AuditLogSearch servicelet stopped");
            AuditLogSearchServicelet.hbTimer.Enabled = false;
        }
        private bool TrySyncOneItem(MailboxSession mailboxSession, ItemSynchronizer itemSynchronizer, ItemType remoteItem)
        {
            SharingEngine.Tracer.TraceDebug <SharingEngine, string>((long)this.GetHashCode(), "{0}: Syncing item {1}", this, remoteItem.ItemId.Id);
            LocalizedException exception = null;

            try
            {
                Exception syncException = null;
                GrayException.MapAndReportGrayExceptions(delegate()
                {
                    try
                    {
                        itemSynchronizer.Sync(remoteItem, mailboxSession, this.ExchangeService);
                    }
                    catch (FailedCommunicationException syncException)
                    {
                        FailedCommunicationException syncException = syncException;
                    }
                    catch (StorageTransientException syncException2)
                    {
                        FailedCommunicationException syncException = syncException2;
                    }
                    catch (ObjectNotFoundException syncException3)
                    {
                        FailedCommunicationException syncException = syncException3;
                    }
                    catch (RecurrenceException exception2)
                    {
                        exception = exception2;
                    }
                    catch (TimeZoneException exception3)
                    {
                        exception = exception3;
                    }
                    catch (ObjectValidationException syncException4)
                    {
                        FailedCommunicationException syncException = syncException4;
                    }
                });
                if (syncException != null)
                {
                    SharingEngine.Tracer.TraceError <SharingEngine, Exception>((long)this.GetHashCode(), "{0}: Transient failure while syncing an item. Exception: {1}", this, syncException);
                    throw new BatchSynchronizationFailedException(syncException);
                }
            }
            catch (GrayException exception)
            {
                GrayException exception4;
                exception = exception4;
            }
            if (exception != null)
            {
                SharingEngine.Tracer.TraceError <SharingEngine, string, LocalizedException>((long)this.GetHashCode(), "{0}: Error syncing item {1}. Exception: {2}", this, remoteItem.ItemId.Id, exception);
                SharingLog.LogEntry(mailboxSession, string.Format("Error syncing item - Subject: {0}, Id: {1}, Exception: {2}", remoteItem.Subject, remoteItem.ItemId.Id, exception));
                return(false);
            }
            return(true);
        }
Beispiel #10
0
        // Token: 0x060000D3 RID: 211 RVA: 0x000057CC File Offset: 0x000039CC
        private static int Execute(GrayException.UserCodeDelegate function, string assistantName)
        {
            Exception exception = null;

            AssistantsRpcServer.Tracer.TraceDebug <string>(0L, "Executing the RPC request for assistant {0}.", assistantName);
            try
            {
                GrayException.MapAndReportGrayExceptions(delegate()
                {
                    try
                    {
                        function();
                    }
                    catch (MapiExceptionMdbOffline exception3)
                    {
                        exception = exception3;
                    }
                    catch (MapiExceptionNotFound exception4)
                    {
                        exception = exception4;
                    }
                    catch (MailboxOrDatabaseNotSpecifiedException exception5)
                    {
                        exception = exception5;
                    }
                    catch (UnknownAssistantException exception6)
                    {
                        exception = exception6;
                    }
                    catch (UnknownDatabaseException exception7)
                    {
                        exception = exception7;
                    }
                    catch (TransientException exception8)
                    {
                        exception = exception8;
                    }
                });
            }
            catch (GrayException exception)
            {
                GrayException exception9;
                exception = exception9;
            }
            catch (Exception exception2)
            {
                exception = exception2;
                ExWatson.SendReportAndCrashOnAnotherThread(exception2);
            }
            if (exception != null)
            {
                return(AssistantsRpcServer.LogExceptionAndGetHR(exception, assistantName));
            }
            return(0);
        }
 // Token: 0x06000B83 RID: 2947 RVA: 0x0002F05C File Offset: 0x0002D25C
 protected void ExecuteWithExceptionHandler(GrayException.UserCodeDelegate callback)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(callback);
     }
     catch (GrayException exception)
     {
         this.InternalFailureCallback(exception, null);
     }
 }
 public static void SendWatsonReportsForGrayExceptions(GrayException.UserCodeDelegate tryCode, Func <Exception, bool> ignoreFunc)
 {
     GrayException.MapAndReportGrayExceptions(tryCode, delegate(Exception exception)
     {
         if (ignoreFunc(exception))
         {
             ExWatson.SetWatsonReportAlreadySent(exception);
             return(true);
         }
         return(GrayException.IsGrayException(exception));
     });
 }
 public static void SendWatsonReportsForGrayExceptions(GrayException.UserCodeDelegate tryCode)
 {
     GrayException.MapAndReportGrayExceptions(tryCode, delegate(Exception exception)
     {
         if (OwaDiagnostics.CanIgnoreExceptionForWatsonReport(exception))
         {
             ExWatson.SetWatsonReportAlreadySent(exception);
             return(true);
         }
         return(GrayException.IsGrayException(exception));
     });
 }
Beispiel #14
0
 private void BeginInvokeInternal(TaskCompleteCallback callback)
 {
     base.BeginInvoke(callback);
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             try
             {
                 this.asyncResult = this.BeginInvoke();
             }
             catch (SoapException exception)
             {
                 this.HandleException(exception);
             }
             catch (UriFormatException exception2)
             {
                 this.HandleException(exception2);
             }
             catch (WebException exception3)
             {
                 this.HandleException(exception3);
             }
             catch (IOException ex2)
             {
                 SocketException ex3 = ex2.InnerException as SocketException;
                 if (ex3 == null)
                 {
                     ExWatson.SendReport(ex2, ReportOptions.None, null);
                     this.HandleException(ex2);
                 }
                 else
                 {
                     this.HandleException(ex3);
                 }
             }
             catch (LocalizedException exception4)
             {
                 this.HandleException(exception4);
             }
         });
     }
     catch (GrayException ex)
     {
         this.HandleException(ex.InnerException);
     }
     if (this.asyncResult == null && this.CompleteAtomically())
     {
         this.Complete();
     }
 }
 // Token: 0x06000961 RID: 2401 RVA: 0x0003F4C0 File Offset: 0x0003D6C0
 public static bool TryHandleException(long id, string action, string source, Exception ex)
 {
     ExTraceGlobals.AssistantTracer.TraceError <string, string, Exception>(id, "Exception is caught during {0} for {1}: {2}", action, source, ex);
     if (ex is StorageTransientException || ex is StoragePermanentException || ex is AITransientException || ex is MissingSystemMailboxException || ex is LocalServerException || ex is DataValidationException || ex is DataSourceTransientException || ex is DataSourceOperationException)
     {
         return(true);
     }
     if (GrayException.IsGrayException(ex))
     {
         ExWatson.SendReport(ex, ReportOptions.None, null);
         return(true);
     }
     return(false);
 }
 // Token: 0x06000005 RID: 5 RVA: 0x00002438 File Offset: 0x00000638
 protected override void OnStopInternal()
 {
     Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopping, null, new object[0]);
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Mailbox Assistants Service", 32151);
     if (this.memoryMonitor != null)
     {
         this.memoryMonitor.Stop();
     }
     if (this.watermarkCleanupTimer != null)
     {
         this.watermarkCleanupTimer.Dispose();
     }
     if (this.databaseManager != null)
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 this.databaseManager.Stop();
             });
         }
         catch (GrayException arg)
         {
             AssistantsService.Tracer.TraceDebug <AssistantsService, GrayException>((long)this.GetHashCode(), "{0}: Gray Exception reported during shutdown: {1}", this, arg);
         }
         finally
         {
             this.databaseManager.Dispose();
         }
         AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Assistant Infrastructure", 17815);
     }
     MailboxSearchServer.StopServer();
     AssistantsLog.LogServiceStopEvent(this.activityId);
     AssistantsLog.Stop();
     MailboxAssistantsSlaReportLogFactory.StopAll();
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopped, null, new object[]
         {
             currentProcess.Id,
             "Microsoft Exchange",
             "15.00.1497.010"
         });
     }
     ProcessAccessManager.UnregisterComponent(this);
     ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
     SettingOverrideSync.Instance.Stop();
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} The Mailbox Assistants Service Stopped successfully", 21911);
 }
Beispiel #17
0
 private void ProtectedExecution(AsyncCallback callback, IAsyncResult asyncResult)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             callback(asyncResult);
         });
     }
     catch (GrayException ex)
     {
         ProtocolLog.LogError(this.loggingComponent, this.loggingContext, "WrapCallbackWithUnhandledExceptionAndSendReport: Failed with unexpected exception", ex);
         this.executionAsyncResult.InvokeCallback(ex);
     }
 }
Beispiel #18
0
 private void ExecuteCallback(Exception exception)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             PublicFolderSynchronizer.Tracer.TraceDebug((long)this.GetHashCode(), "Executing callback");
             this.onEndCallback(exception);
             PublicFolderSynchronizer.Tracer.TraceDebug((long)this.GetHashCode(), "Callback executed");
         });
     }
     catch (GrayException ex)
     {
         PublicFolderSynchronizer.Tracer.TraceError <Exception>((long)this.GetHashCode(), "Execcution of the callback failed with exception: {0}", ex.InnerException);
     }
 }
Beispiel #19
0
 public override void Begin(object state)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             base.SafeInitializeLoggingStream();
             MaintenanceSynchronizer maintenanceSynchronizer = new MaintenanceSynchronizer(this, base.SyncInfoEntry.MailboxSession, base.SyncInfoEntry.MailboxPrincipal.MailboxInfo.OrganizationId, base.SyncInfoEntry.WebCollectionUrl, base.SyncInfoEntry.WebId, base.SyncInfoEntry.SiteUrl, base.SyncInfoEntry.DisplayName, base.SyncInfoEntry.ResourceMonitor, this.credentials, ((TeamMailboxSyncConfiguration)base.Config).UseOAuth, ((TeamMailboxSyncConfiguration)base.Config).HttpDebugEnabled, this.syncCycleLogStream);
             maintenanceSynchronizer.BeginExecute(new AsyncCallback(this.OnMaintenanceSynchronizationCompleted), maintenanceSynchronizer);
         });
     }
     catch (GrayException lastError)
     {
         base.LastError = lastError;
         this.End();
     }
 }
Beispiel #20
0
 public override void Begin(object state)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             base.SafeInitializeLoggingStream();
             SiteSynchronizer siteSynchronizer = new SiteSynchronizer(this, base.SyncInfoEntry.MailboxSession, base.SyncInfoEntry.ResourceMonitor, base.SyncInfoEntry.SiteUrl, this.credentials, ((TeamMailboxSyncConfiguration)base.Config).UseOAuth, ((TeamMailboxSyncConfiguration)base.Config).HttpDebugEnabled, this.syncCycleLogStream);
             siteSynchronizer.BeginExecute(new AsyncCallback(this.OnSiteSynchronizationCompleted), siteSynchronizer);
         });
     }
     catch (GrayException lastError)
     {
         base.LastError = lastError;
         this.End();
     }
 }
Beispiel #21
0
 private void HandleDataAvailableEvent(object state)
 {
     QueuePorter <T> .DequeuedItem dequeuedItem = (QueuePorter <T> .DequeuedItem)state;
     try
     {
         this.Contexts[dequeuedItem.ContextIndex].OnDataAvailable(new QueueDataAvailableEventSource <T>(this.Contexts[dequeuedItem.ContextIndex].Queue), new QueueDataAvailableEventArgs <T>(dequeuedItem.Item));
     }
     catch (Exception ex)
     {
         ExTraceGlobals.CoreTracer.TraceError <Exception>((long)this.GetHashCode(), "OnDataAvailable raises Exception: {0}", ex);
         if (!this.AllowToHandleErrors || !GrayException.IsGrayException(ex))
         {
             throw;
         }
         ExWatson.SendReport(ex, ReportOptions.None, null);
     }
 }
Beispiel #22
0
        public bool Invoke(string command, IAssociationAdaptor masterAdaptor, params MailboxAssociation[] associations)
        {
            ArgumentValidator.ThrowIfNull("masterAdaptor", masterAdaptor);
            ADUser masterMailbox       = masterAdaptor.MasterLocator.FindAdUser();
            bool   isRpcCallSuccessful = false;

            GrayException.MapAndReportGrayExceptions(delegate()
            {
                try
                {
                    MailboxLocator[] array = associations.Select(new Func <MailboxAssociation, MailboxLocator>(masterAdaptor.GetSlaveMailboxLocator)).ToArray <MailboxLocator>();
                    this.logger.LogEvent(new SchemaBasedLogEvent <MailboxAssociationLogSchema.CommandExecution>
                    {
                        {
                            MailboxAssociationLogSchema.CommandExecution.Command,
                            command
                        },
                        {
                            MailboxAssociationLogSchema.CommandExecution.GroupMailbox,
                            masterAdaptor.MasterLocator
                        },
                        {
                            MailboxAssociationLogSchema.CommandExecution.UserMailboxes,
                            array
                        }
                    });
                    RpcAssociationReplicatorRunNowParameters rpcAssociationReplicatorRunNowParameters = new RpcAssociationReplicatorRunNowParameters
                    {
                        SlaveMailboxes = array
                    };
                    ReplicationAssistantInvoker.Tracer.TraceDebug <string, RpcAssociationReplicatorRunNowParameters>((long)this.GetHashCode(), "ReplicationAssistantInvoker::ReplicateAssociations. Calling RpcAssociationReplicator in '{0}' with parameter: '{1}'", this.targetServerFqdn, rpcAssociationReplicatorRunNowParameters);
                    using (AssistantsRpcClient assistantsRpcClient = new AssistantsRpcClient(this.targetServerFqdn))
                    {
                        assistantsRpcClient.StartWithParams("MailboxAssociationReplicationAssistant", masterMailbox.ExchangeGuid, masterMailbox.Database.ObjectGuid, rpcAssociationReplicatorRunNowParameters.ToString());
                    }
                    isRpcCallSuccessful = true;
                }
                catch (RpcException ex)
                {
                    this.LogError(Strings.RpcReplicationCallFailed(ex.ErrorCode));
                    masterAdaptor.AssociationStore.SaveMailboxAsOutOfSync();
                }
            });
            return(isRpcCallSuccessful);
        }
Beispiel #23
0
 public void Run()
 {
     ExTraceGlobals.SharingTracer.TraceDebug((long)this.GetHashCode(), "CalendarImporter::Run. Begin.");
     this.results.Reset();
     try
     {
         this.RetrieveSnapshots();
         IEnumerable <Item> icalEnumerator = this.GetIcalEnumerator();
         using (IEnumerator <Item> enumerator = icalEnumerator.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Item promotedItem = enumerator.Current;
                 if (this.deadline.IsOver)
                 {
                     this.results.SetTimeOut();
                     ExTraceGlobals.SharingTracer.TraceDebug((long)this.GetHashCode(), "CalendarImporter::Run. Ran out of time to import items. Skipping the rest.");
                     break;
                 }
                 try
                 {
                     GrayException.MapAndReportGrayExceptions(delegate()
                     {
                         ExTraceGlobals.FaultInjectionTracer.TraceTest <string>(2319854909U, promotedItem.TryGetProperty(ItemSchema.Subject) as string);
                         this.ImportItem(promotedItem);
                     });
                 }
                 catch (GrayException ex)
                 {
                     ExTraceGlobals.SharingTracer.TraceDebug <GrayException>((long)this.GetHashCode(), "CalendarImporter::Run.Found GrayException: {0}.", ex);
                     this.results.RawErrors.Add(ServerStrings.ImportItemThrewGrayException(ex.ToString()));
                 }
             }
         }
         if (!this.deadline.IsOver)
         {
             this.DeleteOutOfDateItems();
         }
     }
     finally
     {
         Util.DisposeIfPresent(this.itemCache);
     }
     ExTraceGlobals.SharingTracer.TraceDebug((long)this.GetHashCode(), "CalendarImporter::Run. End.");
 }
Beispiel #24
0
 public static void SetWithExceptionHandling(string label, ThreadCounter threadCounter, ClientContext clientContext, RequestLogger requestLogger, ThreadContext.ExecuteDelegate executeDelegate)
 {
     ThreadContext.Set(label, threadCounter, clientContext, requestLogger, delegate()
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 executeDelegate();
             });
         }
         catch (GrayException arg)
         {
             string arg2 = (clientContext != null) ? clientContext.IdentityForFilteredTracing : "none";
             ThreadContext.Tracer.TraceError <string, GrayException>(0L, "{0}: failed with exception: {1}", arg2, arg);
         }
     });
 }
 private void UploadPhoto()
 {
     try
     {
         if (GroupMailboxDefaultPhotoUploader.IsFlightEnabled(this.mailboxSession))
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 GroupMailboxDefaultPhotoUploader groupMailboxDefaultPhotoUploader = new GroupMailboxDefaultPhotoUploader(this.adSession, this.mailboxSession, this.group);
                 this.group.ThumbnailPhoto = groupMailboxDefaultPhotoUploader.Upload();
             }, (Exception e) => GrayException.IsSystemGrayException(e));
         }
     }
     catch (LocalizedException arg)
     {
         this.TraceAndReportWarning(new LocalizedString(string.Format("Unable to upload photo for group {0} Error {1}", this.group.PrimarySmtpAddress, arg)));
     }
 }
Beispiel #26
0
 internal static void HandleExceptions(Util.MethodDelegate method, Util.GrayExceptionHandler handler)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             method();
         });
     }
     catch (GrayException ex)
     {
         Util.SendGrayExceptionWatsonReport(ex.ToString());
         handler(ex);
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
     }
 }
Beispiel #27
0
        private void Execute()
        {
            PublicFolderSynchronizer.Tracer.TraceDebug((long)this.GetHashCode(), "Execute() starting");
            Exception exception = null;
            bool      complete  = false;

            try
            {
                GrayException.MapAndReportGrayExceptions(delegate()
                {
                    CommonUtils.CatchKnownExceptions(delegate
                    {
                        complete = this.ExecuteWithinBudget();
                    }, delegate(Exception e)
                    {
                        PublicFolderSynchronizer.Tracer.TraceError <Exception>((long)this.GetHashCode(), "ExecuteWithinBudget call failed with known exception: {0}", e);
                        exception = e;
                    });
                });
            }
            catch (GrayException ex)
            {
                if (ex.InnerException != null)
                {
                    exception = ex.InnerException;
                }
                else
                {
                    exception = ex;
                }
                PublicFolderSynchronizer.Tracer.TraceError <GrayException>((long)this.GetHashCode(), "ExecuteWithinBudget call failed with unknown exception: {0}", ex);
            }
            if (exception != null || complete)
            {
                if (exception != null)
                {
                    exception = PublicFolderSynchronizer.MapToReportableException(exception);
                }
                this.ReportSynchronizerResult(exception, complete);
                this.ExecuteCallback(exception);
                this.Dispose();
            }
        }
 // Token: 0x0600006C RID: 108 RVA: 0x000037A8 File Offset: 0x000019A8
 private void ThreadStart(object queue)
 {
     try
     {
         GrayException.MapAndReportGrayExceptions(delegate()
         {
             ConcurrentQueue <ADUser> tenants = (ConcurrentQueue <ADUser>)queue;
             this.ProcessTenants(tenants);
         });
     }
     catch (GrayException ex)
     {
         ExTraceGlobals.WorkerTracer.TraceError(11881L, ex.ToString());
         AuditLogSearchContext.EventLogger.LogEvent(MSExchangeAuditLogSearchEventLogConstants.Tuple_WorkerException, string.Empty, new object[]
         {
             ex.ToString()
         });
         AuditLogSearchHealthHandler.GetInstance().AuditLogSearchHealth.AddException(ex);
     }
 }
Beispiel #29
0
        public static PolicyLoadStatus LoadAuditableOperations(OrganizationId orgId, Workload workload, out PolicyAuditOperations auditOperations)
        {
            if (orgId == null)
            {
                auditOperations = null;
                return(PolicyLoadStatus.Unknown);
            }
            Exception             ex         = null;
            PolicyLoadStatus      loadStatus = PolicyLoadStatus.Unknown;
            PolicyAuditOperations operations = null;

            try
            {
                GrayException.MapAndReportGrayExceptions(delegate()
                {
                    AuditPolicyUtility.LoadAuditableOperationsInternal(orgId, workload, out loadStatus, out operations);
                });
            }
            catch (GrayException ex2)
            {
                ex = ex2;
            }
            catch (Exception ex3)
            {
                ex = ex3;
                ExWatson.SendReportAndCrashOnAnotherThread(ex3);
            }
            if (ex != null)
            {
                ExTraceGlobals.SessionTracer.TraceError <Workload, OrganizationId, Exception>(0L, "Error occurred while trying to load audit configuration for workload {0} of organization: '{1}'. Exception details: {2}", workload, orgId, ex);
                ProcessInfoEventLogger.Log(StorageEventLogConstants.Tuple_ErrorLoadAuditPolicyConfiguration, orgId.ToString(), new object[]
                {
                    workload,
                    orgId,
                    ex
                });
            }
            auditOperations = operations;
            return(loadStatus);
        }
            // Token: 0x0600003E RID: 62 RVA: 0x00003EC0 File Offset: 0x000020C0
            protected override bool TryRunInternal(Action code, ref ExceptionHandler.ExceptionData args)
            {
                bool      shouldRetry = false;
                bool      result      = false;
                Exception exception   = null;

                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        code();
                        result = true;
                    });
                }
                catch (GrayException ex)
                {
                    exception = ex;
                }
                args.ShouldRetry = shouldRetry;
                args.Exception   = exception;
                return(result);
            }