internal static void SendWatsonReportOnUnhandledException(ExWatson.MethodDelegate methodDelegate, Diagnostics.LastChanceExceptionHandler exceptionHandler) { WatsonReportAction action = Diagnostics.RegisterAdditionalWatsonData(); try { ExWatson.SendReportOnUnhandledException(methodDelegate, delegate(object exception) { bool flag = Diagnostics.SendWatsonReports.Value; Exception ex = exception as Exception; if (ex != null) { if (exceptionHandler != null) { exceptionHandler(ex); } ExTraceGlobals.ExceptionTracer.TraceError <Exception>(0L, "Encountered unhandled exception: {0}", ex); flag = Diagnostics.IsSendReportValid(ex); if (flag) { Diagnostics.LogExceptionWithTrace(FrontEndHttpProxyEventLogConstants.Tuple_InternalServerError, null, ExTraceGlobals.ExceptionTracer, null, "Encountered unhandled exception: {0}", ex); ExWatson.SetWatsonReportAlreadySent(ex); } } ExTraceGlobals.ExceptionTracer.TraceError <bool>(0L, "SendWatsonReportOnUnhandledException isSendReportValid: {0}", flag); return(flag); }, ReportOptions.None); } finally { ExWatson.UnregisterReportAction(action, WatsonActionScope.Thread); } }
public void SendReportOnUnhandledException(Action action) { ExWatson.SendReportOnUnhandledException(delegate() { action(); }); }
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)); }); }
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: 0x0600000C RID: 12 RVA: 0x000024AC File Offset: 0x000006AC private static void RunServicelet(object serviceletObject) { IServicelet servicelet = serviceletObject as IServicelet; if (servicelet == null) { return; } ExWatson.SendReportOnUnhandledException(new ExWatson.MethodDelegate(servicelet.Run)); }
protected sealed override void OnCustomCommand(int command) { this.SendWatsonReportOnTimeout((string message) => new ExServiceBase.ServiceCustomCommandTimeoutException(message), this.CustomCommandTimeout, delegate { ExWatson.SendReportOnUnhandledException(delegate() { this.OnCustomCommandInternal(command); }); }); }
protected sealed override void OnContinue() { this.SendWatsonReportOnTimeout((string message) => new ExServiceBase.ServiceContinueTimeoutException(message), this.ContinueTimeout, delegate { ExWatson.SendReportOnUnhandledException(delegate() { this.OnContinueInternal(); }); }); }
internal static void TraceErrorOnUnhandledException(ExWatson.MethodDelegate methodDelegate) { ExWatson.SendReportOnUnhandledException(methodDelegate, delegate(object exception) { ExTraceGlobals.ExceptionTracer.TraceError(0L, "Unhandled exception, Exception details: {0}", new object[] { exception }); return(false); }); }
protected sealed override void OnStart(string[] args) { this.SendWatsonReportOnTimeout((string message) => new ExServiceBase.ServiceStartTimeoutException(message), this.StartTimeout, delegate { ExWatson.SendReportOnUnhandledException(delegate() { try { this.OnStartInternal(args); } catch (ExServiceBase.GracefulServiceStartupFailureException) { this.Stop(); } }); }); }
private void ExecuteAsyncEntryPoint(object parameter) { Exception arg = null; try { ExWatson.SendReportOnUnhandledException(new ExWatson.MethodDelegate(this.Execute), (object ex) => !(ex is ThreadAbortException)); } catch (Exception ex) { Exception ex2; arg = ex2; } finally { Action <Activity, Exception> action = (Action <Activity, Exception>)parameter; if (action != null) { action(this, arg); } } }
public void Synchronize() { ExWatson.SendReportOnUnhandledException(delegate() { lock (ActiveCopiesCacheProvider.synchronizeLock) { try { if (!this.serverLocator.IsUsable) { this.serverLocator.Dispose(); this.serverLocator = ServerLocatorServiceClient.Create("localhost"); } GetActiveCopiesForDatabaseAvailabilityGroupParameters getActiveCopiesForDatabaseAvailabilityGroupParameters = new GetActiveCopiesForDatabaseAvailabilityGroupParameters(); getActiveCopiesForDatabaseAvailabilityGroupParameters.CachedData = false; this.activeCopiesList = new List <DatabaseServerInformation>(this.serverLocator.GetActiveCopiesForDatabaseAvailabilityGroupExtended(getActiveCopiesForDatabaseAvailabilityGroupParameters)); } catch (ServerLocatorClientTransientException) { } } }); }
// Token: 0x0600008A RID: 138 RVA: 0x000046B4 File Offset: 0x000028B4 internal static void SendWatsonReportOnUnhandledException(ExWatson.MethodDelegate methodDelegate) { ExWatson.SendReportOnUnhandledException(methodDelegate, delegate(object exception) { bool flag = true; Exception ex = exception as Exception; if (ex != null) { ExTraceGlobals.FrameworkTracer.TraceError <Exception>(0L, "Encountered unhandled exception: {0}", ex); flag = Common.IsSendReportValid(ex); } ExTraceGlobals.FrameworkTracer.TraceError <bool>(0L, "SendWatsonReportOnUnhandledException isSendReportValid: {0}", flag); if (flag) { Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_ErrWebException, Common.PeriodicKey, new object[] { ex.Message, ex.StackTrace }); } RequestDetailsLoggerBase <RequestDetailsLogger> .Current.AppendGenericError("WatsonExceptionMessage", ex.ToString()); return(flag); }, ReportOptions.None); }
public void Start() { ExWatson.SendReportOnUnhandledException(delegate() { int mailboxesSearchedCount = 0; long itemCount = 0L; long totalSize = 0L; long unsearchableItemCount = 0L; long unsearchableTotalSize = 0L; List <ErrorRecord> unsearchableFailedMailboxes = null; List <ErrorRecord> failedMailboxes = null; List <KeywordHit> keywordHits = null; SearchState searchState = SearchState.NotStarted; Exception exception = null; try { GrayException.MapAndReportGrayExceptions(delegate() { try { if (this.searchObject != null) { this.searchObject.ScenarioId = ScenarioData.Current["SID"]; } if (this.isStatisticsOnlySearch) { if (string.IsNullOrEmpty(this.keywordStatisticsQuery)) { ScenarioData.Current["S"] = "ES"; if (this.searchObject != null && !string.IsNullOrEmpty(this.searchObject.CalculatedQuery)) { ScenarioData.Current["QL"] = this.searchObject.CalculatedQuery.Length.ToString(); } } else { ScenarioData.Current["S"] = "KS"; ScenarioData.Current["QL"] = this.keywordStatisticsQuery.Length.ToString(); } string text = (this.searchObject == null) ? string.Empty : this.searchObject.CalculatedQuery; List <string> list = null; if (this.ExportContext.Sources != null && this.ExportContext.Sources.Count > 0) { ScenarioData.Current["M"] = this.ExportContext.Sources.Count.ToString(); ISource source = this.ExportContext.Sources[0]; if (string.IsNullOrEmpty(text)) { text = source.SourceFilter; } list = new List <string>(this.ExportContext.Sources.Count); foreach (ISource source2 in this.ExportContext.Sources) { list.Add(source2.LegacyExchangeDN); } } if (list != null || this.isPFSearchFlightingEnabled) { bool flag = false; this.GetSearchResultEstimation(text, list, out mailboxesSearchedCount, false, ref flag, out itemCount, out totalSize, out failedMailboxes); } if (!string.IsNullOrEmpty(this.keywordStatisticsQuery) && !this.isTaskAborted) { List <ErrorRecord> list2 = null; List <KeywordStatisticsSearchResultType> keywordStatistics = this.ewsClient.GetKeywordStatistics(this.executingUserPrimarySmtpAddress, this.keywordStatisticsQuery, this.ExportContext.ExportMetadata.Language, (list != null) ? list : new List <string>(1), out list2, (this.searchObject == null || !this.isPFSearchFlightingEnabled) ? null : this.searchObject.Name); keywordHits = Util.ConvertToKeywordHitList(keywordStatistics, this.userKeywordsMap); if (list2 != null) { if (failedMailboxes == null) { failedMailboxes = list2; } else { failedMailboxes.AddRange(list2); } } } if (Util.IncludeUnsearchableItems(this.ExportContext) && !this.isTaskAborted && (list != null || (this.searchObject != null && this.searchObject.IsFeatureFlighted("PublicFolderSearchFlighted")))) { KeywordHit keywordHit = null; if (keywordHits != null) { keywordHit = new KeywordHit { Phrase = "652beee2-75f7-4ca0-8a02-0698a3919cb9" }; keywordHits.Add(keywordHit); } bool flag2 = false; if (this.searchObject != null && this.searchObject.IsFeatureFlighted("PublicFolderSearchFlighted")) { this.GetSearchResultEstimation(text, list, out mailboxesSearchedCount, true, ref flag2, out unsearchableItemCount, out unsearchableTotalSize, out unsearchableFailedMailboxes); if (flag2 && keywordHit != null) { keywordHit.Count += (int)unsearchableItemCount; } } else { foreach (string mailboxId in list) { if (this.isTaskAborted) { break; } long unsearchableItemStatistics = this.ewsClient.GetUnsearchableItemStatistics(this.executingUserPrimarySmtpAddress, mailboxId); unsearchableItemCount += unsearchableItemStatistics; if (keywordHit != null) { keywordHit.Count += (int)unsearchableItemStatistics; keywordHit.MailboxCount += ((unsearchableItemStatistics == 0L) ? 0 : 1); } } } } searchState = (this.isTaskAborted ? SearchState.EstimateStopped : SearchState.EstimateSucceeded); } else { ScenarioData.Current["S"] = "CS"; this.exportHandler.Prepare(); this.exportHandler.Export(); this.PrepareCompleted(this.exportHandler.SearchResults); searchState = (this.isTaskAborted ? SearchState.Stopped : SearchState.Succeeded); } } catch (ExportException exception) { ExportException exception = exception; } catch (StorageTransientException exception2) { ExportException exception = exception2; } catch (StoragePermanentException exception3) { ExportException exception = exception3; } catch (DataSourceOperationException exception4) { ExportException exception = exception4; } }); } catch (GrayException ex) { exception = ex; ExTraceGlobals.SearchTracer.TraceError <GrayException>((long)this.GetHashCode(), "GrayException {0} is thrown", ex); } finally { if (exception != null) { string message = exception.Message; if (string.IsNullOrEmpty(message) && exception.InnerException != null) { message = exception.InnerException.Message; } SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(this.ExportContext.ExportMetadata.ExportName, this.DiscoverySearchTaskErrorHint, exception); this.Errors.Add(message); mailboxesSearchedCount = 0; itemCount = 0L; totalSize = 0L; unsearchableItemCount = 0L; keywordHits = null; searchState = (this.isStatisticsOnlySearch ? SearchState.EstimateFailed : SearchState.Failed); } if (failedMailboxes != null && failedMailboxes.Count > 0) { foreach (ErrorRecord errorRecord in failedMailboxes) { this.Errors.Add(Util.GenerateErrorMessageFromErrorRecord(errorRecord)); } this.Errors.Insert(0, "Number of failed mailboxes: " + failedMailboxes.Count); } try { if (this.isStatisticsOnlySearch) { this.EstimateCompleted(mailboxesSearchedCount, itemCount, totalSize, unsearchableItemCount, keywordHits, searchState); } else { this.ExportCompleted(searchState); } } catch (ExportException ex2) { SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(this.ExportContext.ExportMetadata.ExportName, this.DiscoverySearchTaskErrorHint, ex2); this.Errors.Add(ex2.Message); searchState = (this.isStatisticsOnlySearch ? SearchState.EstimateFailed : SearchState.Failed); } } }, delegate(object exception) { ExTraceGlobals.SearchTracer.TraceError((long)this.GetHashCode(), "InternalStart: Unhandled exception {0}", new object[] { exception }); SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(this.ExportContext.ExportMetadata.ExportName, this.DiscoverySearchTaskErrorHint, exception.ToString()); return(!(exception is GrayException)); }); }
public void OnBeginRequest(HttpContextBase context) { ExWatson.SendReportOnUnhandledException(delegate() { RequestDetailsLogger requestDetailsLogger = null; RoutingUpdateDiagnostics routingUpdateDiagnostics = this.diagnostics as RoutingUpdateDiagnostics; if (routingUpdateDiagnostics != null) { HttpContext context2 = context.ApplicationInstance.Context; requestDetailsLogger = RequestDetailsLoggerBase <RequestDetailsLogger> .InitializeRequestLogger(); RequestDetailsLoggerBase <RequestDetailsLogger> .SetCurrent(context2, requestDetailsLogger); requestDetailsLogger.Set(RoutingUpdateModuleMetadata.Protocol, RequestDetailsLogger.ProtocolType.Value); routingUpdateDiagnostics.Clear(); } NameValueCollection headers = context.Request.Headers; List <string> list = new List <string>(); list.AddIfNotNull(headers.Get("X-RoutingEntry")); if (RoutingUpdateModule.RUMLegacyRoutingEntryEnabled.Value) { list.AddIfNotNull(headers.Get("X-LegacyRoutingEntry")); } if (list.Count > 0) { try { foreach (string text in list) { string[] source = text.Split(new char[] { ',' }); IEnumerable <IRoutingEntry> routingEntries = from entry in source where RoutingEntryHeaderSerializer.IsValidHeaderString(entry) select RoutingEntryHeaderSerializer.Deserialize(entry); foreach (string value in this.GetRoutingUpdates(routingEntries)) { context.Response.Headers.Add("X-RoutingEntryUpdate", value); } } } catch (Exception ex) { requestDetailsLogger.AppendGenericError("Exception", ex.ToString()); throw; } } if (routingUpdateDiagnostics != null && !requestDetailsLogger.IsDisposed) { if (routingUpdateDiagnostics.GetTotalLatency() > 0L) { routingUpdateDiagnostics.LogLatencies(requestDetailsLogger); requestDetailsLogger.Commit(); } else { requestDetailsLogger.SkipLogging = true; } requestDetailsLogger.Dispose(); } }); }
// Token: 0x0600002C RID: 44 RVA: 0x00003848 File Offset: 0x00001A48 public virtual bool TryRun(Action code, TimeSpan duration, out FaultDefinition faultDefinition, ComplianceMessage context = null, Action <ExceptionHandler.ExceptionData> exceptionHandler = null, CancellationToken cancelToken = default(CancellationToken), double[] retrySchedule = null, [CallerMemberName] string callerMember = null, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0) { bool result2; try { if (retrySchedule == null) { retrySchedule = new double[] { 10.0, 20.0, 30.0 }; } int num = 0; long elapsedMilliseconds = ExceptionHandler.watch.ElapsedMilliseconds; ExceptionHandler.ExceptionData args = new ExceptionHandler.ExceptionData { Exception = null, RetryCount = num, ShouldRetry = false, Context = context }; for (;;) { args.RetryCount = num; bool result = false; ExWatson.SendReportOnUnhandledException(delegate() { result = this.TryRunInternal(code, ref args); }); if (result) { break; } if (exceptionHandler != null) { exceptionHandler(args); } if (!args.ShouldRetry) { goto IL_17D; } int num2 = (int)(duration.TotalMilliseconds * (retrySchedule[(num >= retrySchedule.Length) ? (retrySchedule.Length - 1) : num] / 100.0)); if (num2 > 0) { faultDefinition = FaultDefinition.FromException(args.Exception, true, args.ShouldRetry, callerMember, callerFilePath, callerLineNumber); ExceptionHandler.FaultMessage(context, faultDefinition, false); if (cancelToken.WaitHandle.WaitOne(num2)) { goto IL_17D; } } num++; if ((double)(ExceptionHandler.watch.ElapsedMilliseconds - elapsedMilliseconds) >= duration.TotalMilliseconds || elapsedMilliseconds == ExceptionHandler.watch.ElapsedMilliseconds) { goto IL_17D; } } faultDefinition = null; return(true); IL_17D: faultDefinition = new FaultDefinition(); FaultRecord faultRecord = new FaultRecord(); faultDefinition.Faults.TryAdd(faultRecord); faultRecord.Data["RC"] = args.RetryCount.ToString(); faultRecord.Data["TEX"] = args.ShouldRetry.ToString(); faultRecord.Data["EFILE"] = callerFilePath; faultRecord.Data["EFUNC"] = callerMember; faultRecord.Data["ELINE"] = callerLineNumber.ToString(); if (args.Exception != null) { faultRecord.Data["EX"] = args.Exception.ToString(); LocalizedException ex = args.Exception as LocalizedException; if (ex != null) { faultRecord.Data["UM"] = ex.Message; } } faultDefinition = FaultDefinition.FromException(args.Exception, true, args.ShouldRetry, callerMember, callerFilePath, callerLineNumber); ExceptionHandler.FaultMessage(context, faultDefinition, false); result2 = false; } catch (Exception error) { faultDefinition = FaultDefinition.FromException(error, true, false, callerMember, callerFilePath, callerLineNumber); ExceptionHandler.FaultMessage(context, faultDefinition, true); throw; } return(result2); }
// Token: 0x0600010A RID: 266 RVA: 0x0000677A File Offset: 0x0000497A public void ProcessBodyTag() { ExWatson.SendReportOnUnhandledException(delegate() { List <IStorePropertyBag> propertyBagList = new List <IStorePropertyBag>(100); ExDateTime toProcessDate = ExDateTime.UtcNow.Subtract(TimeSpan.FromDays(15.0)); int indexTrackingCounter = 0; bool trackingCheckRequired = true; string text = null; string text2 = null; string text3 = null; bool flag = false; try { using (MailboxSession session = MailboxSession.OpenAsAdmin(this.principal, CultureInfo.InvariantCulture, "Client=TBA;Action=Conversation Assistant")) { text = session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(); AllItemsFolderHelper.RunQueryOnAllItemsFolder <bool>(session, AllItemsFolderHelper.SupportedSortBy.ReceivedTime, delegate(QueryResult queryResults) { bool flag2 = false; int num = 0; while (!flag2) { IStorePropertyBag[] propertyBags = queryResults.GetPropertyBags(50); if (propertyBags.Length <= 0) { break; } foreach (IStorePropertyBag storePropertyBag2 in propertyBags) { num++; if (num >= 10000) { BodyTagProcessor.Tracer.TraceDebug <string>(0L, "Skip querying as we have reached our maximum limit of emails we want to process for {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()); flag2 = true; break; } string text5 = storePropertyBag2.TryGetProperty(StoreObjectSchema.ItemClass) as string; if (!string.IsNullOrEmpty(text5) && ObjectClass.IsMessage(text5, false)) { if (!(BodyTagProcessor.GetProperty <ExDateTime>(storePropertyBag2, ItemSchema.ReceivedTime, ExDateTime.MinValue) >= toProcessDate)) { flag2 = true; break; } if (trackingCheckRequired && !(storePropertyBag2.TryGetProperty(ItemSchema.ConversationIndexTracking) is PropertyError)) { indexTrackingCounter++; if (indexTrackingCounter >= 10) { BodyTagProcessor.Tracer.TraceDebug <string>(0L, "Not processing BodyTag for mailbox {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()); flag2 = true; break; } } if (storePropertyBag2.TryGetProperty(ItemSchema.BodyTag) is PropertyError || storePropertyBag2.TryGetProperty(ItemSchema.BodyTag) == null) { propertyBagList.Add(storePropertyBag2); } } } trackingCheckRequired = false; } return(true); }, new PropertyDefinition[] { ItemSchema.Id, StoreObjectSchema.ItemClass, ItemSchema.ReceivedTime, ItemSchema.BodyTag, ItemSchema.ConversationIndexTracking }); if (propertyBagList.Count == 0 || indexTrackingCounter >= 10) { string text4 = (propertyBagList.Count == 0) ? " 0 messages to process" : " IndexTrackingCounter reached its limit"; Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingSkipped, null, new object[] { text, text4 }); return; } Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_TotalNumberOfItemsForBodyTagProcessing, null, new object[] { propertyBagList.Count, text }); foreach (IStorePropertyBag storePropertyBag in propertyBagList) { try { using (MessageItem messageItem = MessageItem.Bind(session, storePropertyBag[ItemSchema.Id] as StoreId)) { if (!(messageItem is RightsManagedMessageItem)) { messageItem.OpenAsReadWrite(); messageItem[ItemSchema.BodyTag] = messageItem.Body.CalculateBodyTag(); messageItem.Save(SaveMode.ResolveConflicts); } } } catch (ObjectNotFoundException) { BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "ObjectNotFound exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text); } catch (AccessDeniedException) { BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "AccessDenied exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text); } catch (CorruptDataException) { BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "Corrupt data exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text); } catch (VirusException) { BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "Virus exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text); } catch (PropertyErrorException) { BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "PropertyErrorException thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text); } catch (StoragePermanentException ex) { if (!(ex.InnerException is MapiExceptionCallFailed)) { throw; } BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "MapiExceptionCallFailed thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text); } } } Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingSucceeded, null, new object[] { text }); } catch (ObjectNotFoundException ex2) { flag = true; text2 = ex2.Message; text3 = ex2.StackTrace; } catch (CorruptDataException ex3) { flag = true; text2 = ex3.Message; text3 = ex3.StackTrace; } catch (QuotaExceededException ex4) { flag = true; text2 = ex4.Message; text3 = ex4.StackTrace; } catch (MessageSubmissionExceededException ex5) { flag = true; text2 = ex5.Message; text3 = ex5.StackTrace; } catch (ConnectionFailedPermanentException ex6) { flag = true; text2 = ex6.Message; text3 = ex6.StackTrace; } catch (MailboxUnavailableException ex7) { flag = true; text2 = ex7.Message; text3 = ex7.StackTrace; } catch (StorageTransientException ex8) { flag = true; text2 = ex8.Message; text3 = ex8.StackTrace; } catch (StoragePermanentException ex9) { if (!(ex9.InnerException is MapiExceptionJetErrorLogDiskFull)) { throw; } flag = true; text2 = ex9.Message; text3 = ex9.StackTrace; } finally { if (flag) { Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingFailed, null, new object[] { text, text2 ?? "<null>", text3 ?? "<null>" }); } } }, delegate(object exception) { Exception ex = exception as Exception; if (ex != null) { Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingFailed, null, new object[] { this.principal.MailboxInfo.PrimarySmtpAddress.ToString(), ex.Message ?? "<null>", ex.StackTrace ?? "<null>" }); } return(true); }, ReportOptions.None); }
private void WorkItemPumpingThreadEntry() { MailboxSearchWorkItem workItem = null; ExWatson.SendReportOnUnhandledException(delegate() { WaitHandle[] waitHandles = new WaitHandle[] { this.shutdownEvent, this.queueSemaphore }; WaitHandle[] waitHandles2 = new WaitHandle[] { this.shutdownEvent, this.workItemSemaphore }; while (WaitHandle.WaitAny(waitHandles) != 0) { if (WaitHandle.WaitAny(waitHandles2) == 0) { MailboxSearchServer.Tracer.TraceDebug <ExDateTime>((long)this.GetHashCode(), "WorkItemPumpingThread received shutdown signal when waiting for work item resource, exiting at {0}", ExDateTime.Now); return; } workItem = this.GetNextWorkItem(); if (workItem != null) { bool releaseSemaphore = !workItem.IsCompleted; try { GrayException.MapAndReportGrayExceptions(delegate() { bool flag = true; try { lock (this) { switch (workItem.Action) { case WorkItemAction.Start: workItem.Start(); break; case WorkItemAction.Remove: workItem.Remove(); break; } flag = workItem.IsCompleted; } } finally { if (flag) { this.RemoveWorkItem(workItem.SearchId, releaseSemaphore, workItem.IsEstimateOnly); } } }); } catch (GrayException ex) { MailboxSearchServer.Tracer.TraceError <SearchId, Exception>((long)this.GetHashCode(), "WorkItem {0} has unhandled exception {1}, the work item is discarded!", workItem.SearchId, ex); SearchEventLogger.Instance.LogDiscoverySearchServerErrorEvent("An unhandled exception occurred while processing the work item, ignoring and continuing the processing of queue", workItem.SearchId.SearchName, workItem.SearchId.MailboxDsName, ex); } } } MailboxSearchServer.Tracer.TraceDebug <ExDateTime>((long)this.GetHashCode(), "WorkItemPumpingThread received shutdown signal when waiting for Queue, exiting at {0}", ExDateTime.Now); }, delegate(object exception) { MailboxSearchServer.Tracer.TraceError((long)this.GetHashCode(), "ExWatsonWrappedCall: Unhandled exception {0}", new object[] { exception }); SearchEventLogger.Instance.LogDiscoverySearchServerErrorEvent("ExWatsonWrappedCall: Unhandled exception", (workItem != null) ? workItem.SearchId.SearchName : null, (workItem != null) ? workItem.SearchId.MailboxDsName : null, exception.ToString()); return(!(exception is GrayException)); }); }