internal static LocalizedString DiagnoseException(string serverFqdn, Guid mdbGuid, Exception exception) { try { bool flag = false; using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=Management", serverFqdn, null, null, null)) { MdbStatus[] array = exRpcAdmin.ListMdbStatus(new Guid[] { mdbGuid }); if (array.Length != 0) { flag = ((array[0].Status & MdbStatusFlags.Online) == MdbStatusFlags.Online); } } if (!flag) { return(Strings.MapiTransactionDiagnosticTargetDatabaseDismounted); } } catch (MapiPermanentException exception2) { return(Strings.MapiTransactionDiagnosticStoreStateCheckFailure(SearchCommon.ShortErrorMsgFromException(exception2))); } catch (MapiRetryableException exception3) { return(Strings.MapiTransactionDiagnosticStoreStateCheckFailure(SearchCommon.ShortErrorMsgFromException(exception3))); } return(SearchCommon.ShortErrorMsgFromException(exception)); }
private bool CheckForServices(SearchTestResult result) { bool flag = false; if (!SearchCommon.IsServiceRunning("MSExchangeIS", result.Server, out flag)) { if (!flag) { result.SetErrorTestResult(EventId.ServiceNotRunning, Strings.TestSearchServiceNotRunning("MSExchangeIS")); return(true); } } else if (!SearchCommon.IsServiceRunning("MSExchangeFASTSearch", result.Server, out flag)) { if (!flag) { result.SetErrorTestResult(EventId.ServiceNotRunning, Strings.TestSearchServiceNotRunning("MSExchangeFASTSearch")); return(true); } } else if (!SearchCommon.IsServiceRunning("HostControllerService", result.Server, out flag) && !flag) { result.SetErrorTestResult(EventId.ServiceNotRunning, Strings.TestSearchServiceNotRunning("HostControllerService")); return(true); } return(false); }
private void HandleExceptionInTestThread(Guid mdbGuid, EventId id, SearchTestResult result, Exception e) { if (this.CheckForServices(result)) { return; } TestSearch.TestSearchTracer.TraceDebug <Exception>((long)this.GetHashCode(), "got exception {0}", e); string error = SearchCommon.DiagnoseException(result.Server, mdbGuid, e); if (id == EventId.MapiError) { result.SetErrorTestResult(id, Strings.TestSearchMapiError(result.Database, error)); return; } result.SetErrorTestResult(id, Strings.TestSearchActiveManager(result.Database, error)); }
private void SearchForMessage(MessageSearcher messageSearcher, SearchTestResult result) { if (messageSearcher == null) { throw new ArgumentNullException("messageSearcher"); } if (result == null) { throw new ArgumentNullException("result"); } TimeSpan timeout = new TimeSpan(0, 0, 1); DateTime utcNow = DateTime.UtcNow; Exception ex = null; try { this.threadExit.CheckStop(); messageSearcher.InitializeSearch(); bool flag = false; int tickCount = Environment.TickCount; while (!flag) { this.threadExit.CheckStop(); try { flag = messageSearcher.DoSearch(); int tickCount2 = Environment.TickCount; if (flag) { result.SetTestResult(true, new TimeSpan((long)((tickCount2 - tickCount) * 10000)).TotalSeconds); } } catch (MapiRetryableException exception) { this.monitor.PushMessage(SearchCommon.DiagnoseException(result.Server, result.DatabaseGuid, exception)); } this.threadExit.CheckStop(); if (!flag) { Thread.Sleep(timeout); } } } catch (MapiExceptionNotFound mapiExceptionNotFound) { ex = mapiExceptionNotFound; } catch (MapiRetryableException ex2) { ex = ex2; } catch (MapiPermanentException ex3) { ex = ex3; } catch (TestSearchOperationAbortedException) { TestSearch.TestSearchTracer.TraceDebug((long)this.GetHashCode(), "Thread terminated on TestSearchOperationAbortedException"); this.monitor.PushMessage(Strings.TestSearchTestThreadTimeOut); result.SetErrorTestResultWithTestThreadTimeOut(); } finally { if (ex != null) { this.HandleExceptionInTestThread(result.DatabaseGuid, EventId.MapiError, result, ex); } } }