Пример #1
0
        public override byte[] GetTenantActiveCryptoMode(int version, byte[] inputParameterBytes)
        {
            GetTenantActiveCryptoModeRpcParameters getTenantActiveCryptoModeRpcParameters = null;

            byte[] result;
            try
            {
                getTenantActiveCryptoModeRpcParameters = new GetTenantActiveCryptoModeRpcParameters(inputParameterBytes);
                int tenantActiveCryptoMode = ServerManager.GetTenantActiveCryptoMode(getTenantActiveCryptoModeRpcParameters.ClientManagerContext);
                ActiveCryptoModeResult[] originalResults = new ActiveCryptoModeResult[]
                {
                    new ActiveCryptoModeResult(tenantActiveCryptoMode, null)
                };
                GetTenantActiveCryptoModeRpcResults getTenantActiveCryptoModeRpcResults = new GetTenantActiveCryptoModeRpcResults(new OverallRpcResult(null), originalResults);
                result = getTenantActiveCryptoModeRpcResults.Serialize();
            }
            catch (Exception ex)
            {
                if (!(ex is RightsManagementServerException))
                {
                    ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcServerWrapper, ServerManagerLog.EventType.Error, (getTenantActiveCryptoModeRpcParameters != null) ? getTenantActiveCryptoModeRpcParameters.ClientManagerContext : null, string.Format("ServerManager.GetTenantActiveCryptoMode has thrown unhandled exception {0}", ServerManagerLog.GetExceptionLogString(ex, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                    ExWatson.SendReportAndCrashOnAnotherThread(ex);
                }
                GetTenantActiveCryptoModeRpcResults getTenantActiveCryptoModeRpcResults2 = new GetTenantActiveCryptoModeRpcResults(new OverallRpcResult(ex), Array <ActiveCryptoModeResult> .Empty);
                result = getTenantActiveCryptoModeRpcResults2.Serialize();
            }
            return(result);
        }
Пример #2
0
        public override byte[] AcquireTenantLicenses(int version, byte[] inputParameterBytes)
        {
            XmlNode[] rac = null;
            XmlNode[] clc = null;
            AcquireTenantLicensesRpcParameters acquireTenantLicensesRpcParameters = null;

            byte[] result;
            try
            {
                acquireTenantLicensesRpcParameters = new AcquireTenantLicensesRpcParameters(inputParameterBytes);
                ServerManager.AcquireTenantLicenses(acquireTenantLicensesRpcParameters.ClientManagerContext, acquireTenantLicensesRpcParameters.MachineCertificateChain, acquireTenantLicensesRpcParameters.Identity, out rac, out clc);
                AcquireTenantLicensesRpcResults acquireTenantLicensesRpcResults = new AcquireTenantLicensesRpcResults(new OverallRpcResult(null), rac, clc);
                result = acquireTenantLicensesRpcResults.Serialize();
            }
            catch (Exception ex)
            {
                if (!(ex is RightsManagementServerException))
                {
                    ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcServerWrapper, ServerManagerLog.EventType.Error, (acquireTenantLicensesRpcParameters != null) ? acquireTenantLicensesRpcParameters.ClientManagerContext : null, string.Format("ServerManager.AcquireTenantLicenses has thrown unhandled exception {0}", ServerManagerLog.GetExceptionLogString(ex, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                    ExWatson.SendReportAndCrashOnAnotherThread(ex);
                }
                AcquireTenantLicensesRpcResults acquireTenantLicensesRpcResults2 = new AcquireTenantLicensesRpcResults(new OverallRpcResult(ex), Array <XmlNode> .Empty, Array <XmlNode> .Empty);
                result = acquireTenantLicensesRpcResults2.Serialize();
            }
            return(result);
        }
Пример #3
0
 private static AsyncCallback WrapCallbackWithUnhandledExceptionAndCrash(AsyncCallback callback)
 {
     if (callback == null)
     {
         return(null);
     }
     return(delegate(IAsyncResult asyncResult)
     {
         RightsManagementAsyncResult asyncResultRM = asyncResult as RightsManagementAsyncResult;
         try
         {
             if (asyncResultRM != null)
             {
                 asyncResultRM.InvokeSaveContextCallback();
             }
             callback(asyncResult);
         }
         catch (Exception exception)
         {
             Exception exception2;
             ExWatson.SendReportAndCrashOnAnotherThread(exception2, ReportOptions.None, delegate(Exception exception, int threadId)
             {
                 if (asyncResultRM != null)
                 {
                     asyncResultRM.InvokeSaveContextCallback();
                 }
             }, null);
             throw;
         }
     });
 }
 public static CancelableAsyncCallback WrapCancellableCallbackWithUnhandledExceptionHandlerAndUpdatePoisonContext(CancelableAsyncCallback callback)
 {
     if (callback == null)
     {
         return(null);
     }
     return(delegate(ICancelableAsyncResult asyncResult)
     {
         RightsManagementAsyncResult asyncResultRM = null;
         if (asyncResult != null && asyncResult.AsyncState != null)
         {
             asyncResultRM = (asyncResult.AsyncState as RightsManagementAsyncResult);
         }
         try
         {
             if (asyncResultRM != null)
             {
                 asyncResultRM.InvokeSaveContextCallback();
             }
             callback(asyncResult);
         }
         catch (Exception exception)
         {
             ExWatson.SendReportAndCrashOnAnotherThread(exception, ReportOptions.None, delegate(Exception param0, int param1)
             {
                 if (asyncResultRM != null)
                 {
                     asyncResultRM.InvokeSaveContextCallback();
                 }
             }, null);
             throw;
         }
     });
 }
Пример #5
0
        private static void CrashOnCallTimeout(object state)
        {
            Thread    thread    = (Thread)state;
            Exception exception = new TimeoutException(string.Format("RpcServerWrapper.EnqueueRequest call timed out after {0} on thread {1}", RpcServerWrapper.enqueueRequestTimeout, (thread != null) ? thread.ManagedThreadId : -1));

            ExWatson.SendReportAndCrashOnAnotherThread(exception);
        }
 // Token: 0x06000022 RID: 34 RVA: 0x000025C4 File Offset: 0x000007C4
 public override byte[] ObtainTokens(byte[] request)
 {
     byte[] result;
     try
     {
         RequestedAction         requestedAction         = RequestedAction.Invalid;
         Guid                    mailboxGuid             = Guid.Empty;
         int                     requestedTokenCount     = 0;
         int                     totalTokenCount         = 0;
         string                  clientHostName          = null;
         string                  clientProcessName       = null;
         string                  clientType              = null;
         MdbefPropertyCollection mdbefPropertyCollection = MdbefPropertyCollection.Create(request, 0, request.Length);
         object                  obj;
         if (mdbefPropertyCollection.TryGetValue(2415984712U, out obj) && obj is Guid)
         {
             mailboxGuid = (Guid)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416050179U, out obj) && obj is int)
         {
             requestedAction = (RequestedAction)((int)obj);
         }
         if (mdbefPropertyCollection.TryGetValue(2416115715U, out obj) && obj is int)
         {
             requestedTokenCount = (int)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416181251U, out obj) && obj is int)
         {
             totalTokenCount = (int)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416312351U, out obj) && obj != null && obj is string)
         {
             clientHostName = (string)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416377887U, out obj) && obj != null && obj is string)
         {
             clientProcessName = (string)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416246815U, out obj) && obj != null && obj is string)
         {
             clientType = (string)obj;
         }
         bool   flag  = this.ObtainTokens(mailboxGuid, requestedAction, requestedTokenCount, totalTokenCount, clientHostName, clientProcessName, clientType);
         byte[] bytes = new MdbefPropertyCollection
         {
             {
                 2566914059U,
                 flag
             }
         }.GetBytes();
         result = bytes;
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
         result = null;
     }
     return(result);
 }
Пример #7
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: 0x06001EF0 RID: 7920 RVA: 0x0008BF5C File Offset: 0x0008A15C
 protected void SendReportAndCrash(Exception ex, string key)
 {
     this.LimitReached = true;
     ReplayEventLogConstants.Tuple_ProcessDiagnosticsTerminatingService.LogEvent(null, new object[]
     {
         ex.Message,
         key
     });
     if (!this.DisableCrash)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(ex);
     }
 }
        protected virtual void HandleUnHandledException(string operationName, ClientInformation clientInfo, Exception e)
        {
            ExTraceGlobals.DiagnosticsAggregationTracer.TraceError <string, Exception>(0L, "Operation {0} encountered exception {1}", operationName, e);
            DiagnosticsAggregationServicelet.EventLog.LogEvent(MSExchangeDiagnosticsAggregationEventLogConstants.Tuple_DiagnosticsAggregationServiceUnexpectedException, null, new object[]
            {
                operationName,
                e.ToString()
            });
            DiagnosticsAggregationEvent evt = (operationName == "GetLocalView") ? DiagnosticsAggregationEvent.LocalViewRequestReceivedFailed : DiagnosticsAggregationEvent.AggregatedViewRequestReceivedFailed;

            this.log.LogOperationFromClient(evt, clientInfo, null, e.ToString());
            ExWatson.SendReportAndCrashOnAnotherThread(e);
        }
Пример #10
0
        public RpcErrorExceptionInfo RunRpcServerOperation(string databaseName, RpcServerOperation rpcOperation)
        {
            RpcErrorExceptionInfo result = new RpcErrorExceptionInfo();

            try
            {
                try
                {
                    rpcOperation();
                }
                catch (MapiRetryableException ex)
                {
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex);
                }
                catch (MapiPermanentException ex2)
                {
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex2);
                }
                catch (TBaseTransientException ex3)
                {
                    TBaseTransientException ex4 = (TBaseTransientException)((object)ex3);
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex4);
                }
                catch (TBaseException ex5)
                {
                    TBaseException ex6 = (TBaseException)((object)ex5);
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex6);
                }
                catch (TransientException ex7)
                {
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex7);
                }
                catch (Exception ex8)
                {
                    if (this.IsKnownException(ex8))
                    {
                        result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex8);
                    }
                    else
                    {
                        ExWatson.SendReportAndCrashOnAnotherThread(ex8);
                    }
                }
            }
            catch (Exception exception)
            {
                ExWatson.SendReportAndCrashOnAnotherThread(exception);
            }
            return(result);
        }
 // Token: 0x06000106 RID: 262 RVA: 0x00007E4C File Offset: 0x0000604C
 public override byte[] Continue(Guid sessionId, bool continueInBackground, int resultLimit, ref int resultSize, ref bool more, ref int progress)
 {
     byte[] result;
     try
     {
         ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch server is entering Continue");
         this.WaitForSessionManager();
         resultSize = 0;
         more       = false;
         progress   = 0;
         LogSession logSession = this.sessionManager.GetSession(sessionId);
         try
         {
             byte[] array = new byte[Math.Min(resultLimit, 1048576)];
             resultSize = logSession.Read(array, 0, array.Length, out more, out progress, !continueInBackground);
             if (more && continueInBackground)
             {
                 ExTraceGlobals.ServiceTracer.TraceDebug((long)logSession.GetHashCode(), "Session continuing in background");
                 logSession = null;
             }
             result = array;
         }
         catch (LogSearchException ex)
         {
             PerfCounters.SearchesRejected.Increment();
             ExTraceGlobals.ServiceTracer.TraceDebug <LogSearchException>((long)logSession.GetHashCode(), "Continue was interrupted, Exception: {0}", ex);
             throw ex;
         }
         finally
         {
             if (logSession != null)
             {
                 ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogSearchServer session {0} Continue failed", logSession.Id.ToString());
                 this.sessionManager.CloseSession(logSession);
             }
         }
     }
     catch (LogSearchException)
     {
         throw;
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
         result = null;
     }
     return(result);
 }
        // Token: 0x06000021 RID: 33 RVA: 0x00002588 File Offset: 0x00000788
        public override bool ObtainSubmissionTokens(Guid mailboxGuid, int requestedTokenCount, int totalTokenCount, int submissionType)
        {
            bool result;

            try
            {
                bool flag = this.ObtainTokens(mailboxGuid, RequestedAction.UserMailSubmission, requestedTokenCount, totalTokenCount, null, null, null);
                result = flag;
            }
            catch (Exception exception)
            {
                ExWatson.SendReportAndCrashOnAnotherThread(exception);
                result = false;
            }
            return(result);
        }
Пример #13
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);
     }
 }
Пример #14
0
        private void CheckForOverflow()
        {
            if (RegistryParameters.DisableGranularReplicationOverflow)
            {
                return;
            }
            ReplayCrimsonEvents.BlockModeOverflowOnPassive.Log <string, int>(this.DatabaseName, this.m_maxConsumerDepthInBytes);
            GranularReplicationOverflowException ex = new GranularReplicationOverflowException();

            if (RegistryParameters.WatsonOnBlockModeConsumerOverflow)
            {
                ExWatson.SendReportAndCrashOnAnotherThread(ex);
            }
            if (this.DrainConsumerQ(new TimeSpan(0, 0, 5), false))
            {
                return;
            }
            throw ex;
        }
 // Token: 0x06000107 RID: 263 RVA: 0x00007F80 File Offset: 0x00006180
 public override void Cancel(Guid sessionId)
 {
     try
     {
         ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch server is entering Cancel");
         this.WaitForSessionManager();
         try
         {
             this.sessionManager.CloseSession(this.sessionManager.GetSession(sessionId));
         }
         catch (LogSearchException)
         {
             ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogSearchServer Cancel session {0} failed with LogSearchException", sessionId.ToString());
         }
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
     }
 }
Пример #16
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);
        }
Пример #17
0
        public override byte[] AcquireUseLicenses(int version, byte[] inputParameterBytes)
        {
            AcquireUseLicensesRpcParameters acquireUseLicensesRpcParameters = null;

            byte[] result;
            try
            {
                acquireUseLicensesRpcParameters = new AcquireUseLicensesRpcParameters(inputParameterBytes);
                UseLicenseResult[]           originalResults = ServerManager.AcquireUseLicenses(acquireUseLicensesRpcParameters.ClientManagerContext, acquireUseLicensesRpcParameters.RightsAccountCertificate, acquireUseLicensesRpcParameters.IssuanceLicense, acquireUseLicensesRpcParameters.LicenseeIdentities);
                AcquireUseLicensesRpcResults acquireUseLicensesRpcResults = new AcquireUseLicensesRpcResults(new OverallRpcResult(null), originalResults);
                result = acquireUseLicensesRpcResults.Serialize();
            }
            catch (Exception ex)
            {
                if (!(ex is RightsManagementServerException))
                {
                    ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcServerWrapper, ServerManagerLog.EventType.Error, (acquireUseLicensesRpcParameters != null) ? acquireUseLicensesRpcParameters.ClientManagerContext : null, string.Format("ServerManager.AcquireTenantLicenses has thrown unhandled exception {0}", ServerManagerLog.GetExceptionLogString(ex, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                    ExWatson.SendReportAndCrashOnAnotherThread(ex);
                }
                AcquireUseLicensesRpcResults acquireUseLicensesRpcResults2 = new AcquireUseLicensesRpcResults(new OverallRpcResult(ex), Array <UseLicenseResult> .Empty);
                result = acquireUseLicensesRpcResults2.Serialize();
            }
            return(result);
        }
Пример #18
0
        private void RunOperation(Action operation)
        {
            Exception ex = null;

            try
            {
                operation();
            }
            catch (DatabaseHealthTrackerException ex2)
            {
                ex = ex2;
            }
            catch (Exception ex3)
            {
                ExWatson.SendReportAndCrashOnAnotherThread(ex3);
                ex = ex3;
            }
            if (ex != null)
            {
                MonitoringService.Tracer.TraceError <Exception>((long)this.GetHashCode(), "RunOperation() is rethrowing exception: {0}", ex);
                ExceptionDetail detail = new ExceptionDetail(ex);
                throw new FaultException <ExceptionDetail>(detail, ex.Message);
            }
        }
Пример #19
0
        // Token: 0x06000085 RID: 133 RVA: 0x00003FEC File Offset: 0x000021EC
        public TaskExecuteResult ExecuteTask(TimeSpan queueAndDelayTime, TimeSpan totalTime, bool calledFromTimeout)
        {
            base.CheckDisposed();
            Stopwatch stopwatch = Stopwatch.StartNew();

            try
            {
                this.InternalPreExecute();
                try
                {
                    if (!calledFromTimeout)
                    {
                        this.InternalExecute();
                    }
                }
                catch (Exception exception)
                {
                    if (!this.TryHandleException(exception))
                    {
                        if (Debugger.IsAttached)
                        {
                            Debugger.Break();
                        }
                        else
                        {
                            if (Configuration.CrashOnUnhandledException)
                            {
                                try
                                {
                                    ExWatson.SendReportAndCrashOnAnotherThread(exception);
                                    goto IL_63;
                                }
                                finally
                                {
                                    try
                                    {
                                        Process.GetCurrentProcess().Kill();
                                    }
                                    catch (Win32Exception)
                                    {
                                    }
                                    Environment.Exit(1);
                                }
                            }
                            ExWatson.SendReport(exception, ReportOptions.DoNotFreezeThreads, null);
                        }
                    }
                    IL_63 :;
                }
                finally
                {
                    stopwatch.Stop();
                }
                this.InternalPostExecute(queueAndDelayTime, stopwatch.Elapsed, calledFromTimeout);
            }
            finally
            {
                if (BaseTrace.CurrentThreadSettings.IsEnabled)
                {
                    BaseTrace.CurrentThreadSettings.DisableTracing();
                }
            }
            return(TaskExecuteResult.ProcessingComplete);
        }
 // Token: 0x06000104 RID: 260 RVA: 0x00007A14 File Offset: 0x00005C14
 public override byte[] SearchExtensibleSchema(string clientVersion, string logName, byte[] query, bool continueInBackground, int resultLimit, ref int resultSize, ref Guid sessionId, ref bool more, ref int progress, string clientName)
 {
     byte[] result;
     try
     {
         ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch server is entering Search using extensible result schema.");
         PerfCounters.SearchesProcessed.Increment();
         this.WaitForSessionManager();
         resultSize = 0;
         sessionId  = Guid.Empty;
         more       = false;
         progress   = 0;
         if (query.Length > 65536)
         {
             ExTraceGlobals.ServiceTracer.TraceError <int>((long)this.GetHashCode(), "Search rejected because the query was too complex. Query length: {0}", query.Length);
             PerfCounters.SearchesRejected.Increment();
             throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_QUERY_TOO_COMPLEX);
         }
         Version    schemaVersion = new Version(clientVersion);
         LogSession logSession    = this.sessionManager.CreateSession(logName, schemaVersion);
         try
         {
             LogQuery query2 = LogSearchServer.DeserializeQuery(query);
             logSession.SetQuery(query2);
             if (LogSearchServer.logger.IsEventCategoryEnabled(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchClientQuery.CategoryId, MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchClientQuery.Level))
             {
                 LogSearchServer.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchClientQuery, null, new object[]
                 {
                     clientName,
                     Encoding.UTF8.GetString(query)
                 });
             }
             byte[] array = new byte[Math.Min(resultLimit, 1048576)];
             resultSize = logSession.Read(array, 0, array.Length, out more, out progress, !continueInBackground);
             if (more && continueInBackground)
             {
                 sessionId  = logSession.Id;
                 logSession = null;
             }
             result = array;
         }
         catch (LogSearchException ex)
         {
             PerfCounters.SearchesRejected.Increment();
             ExTraceGlobals.ServiceTracer.TraceDebug <LogSearchException>((long)logSession.GetHashCode(), "Search was interrupted, Exception: {0}", ex);
             throw ex;
         }
         finally
         {
             if (logSession != null)
             {
                 ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogSearchServer session {0} Search failed", logSession.Id.ToString());
                 this.sessionManager.CloseSession(logSession);
             }
         }
     }
     catch (LogSearchException)
     {
         throw;
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
         result = null;
     }
     return(result);
 }