public static string GetDiagnosticContextFromException(Exception exception) { string result = string.Empty; for (Exception ex = exception; ex != null; ex = ex.InnerException) { DiagnosticContext diagnosticContext = null; MapiPermanentException ex2 = ex as MapiPermanentException; MapiRetryableException ex3 = ex as MapiRetryableException; if (ex2 != null) { diagnosticContext = ex2.DiagCtx; } else if (ex3 != null) { diagnosticContext = ex3.DiagCtx; } if (diagnosticContext != null) { result = string.Format("[e::{0}]", diagnosticContext.ToCompactString()); break; } } return(result); }
internal static string GetExceptionDiagnosticInfo(Exception exception) { StringBuilder stringBuilder = new StringBuilder((exception.InnerException == null) ? 1000 : 2000); stringBuilder.Append(exception.Message); Exception ex = (exception.InnerException == null) ? exception : exception.InnerException; MapiPermanentException ex2 = ex as MapiPermanentException; if (ex2 != null) { stringBuilder.AppendFormat(" {0}", StorageExceptionHandler.GetDiagnosticInfo(ex2)); } else { MapiRetryableException ex3 = ex as MapiRetryableException; if (ex3 != null) { stringBuilder.AppendFormat(" {0}", StorageExceptionHandler.GetDiagnosticInfo(ex3)); } else { stringBuilder.AppendFormat(" {0}: {1}", ex.GetType().Name, ex.Message); } } return(stringBuilder.ToString()); }
// Token: 0x060000E2 RID: 226 RVA: 0x00003F80 File Offset: 0x00002180 public static string GetDiagnosticInfo(Exception ex, string diagnosticInfo) { AnchorUtil.ThrowOnNullArgument(ex, "ex"); Exception innerException = ex.InnerException; int num = 0; while (num < 10 && innerException != null) { MapiPermanentException ex2 = innerException as MapiPermanentException; MapiRetryableException ex3 = innerException as MapiRetryableException; string text = innerException.Message; if (ex2 != null) { text = ex2.DiagCtx.ToCompactString(); } else if (ex3 != null) { text = ex3.DiagCtx.ToCompactString(); } if (!string.IsNullOrEmpty(text)) { if (diagnosticInfo == null) { diagnosticInfo = string.Format(CultureInfo.InvariantCulture, "InnerException:{0}:{1}", new object[] { innerException.GetType().Name, text }); } else { diagnosticInfo = string.Format(CultureInfo.InvariantCulture, "{0} InnerException:{1}:{2}", new object[] { diagnosticInfo, innerException.GetType().Name, text }); } } num++; innerException = innerException.InnerException; } string value = string.Empty; MigrationPermanentException ex4 = ex as MigrationPermanentException; MigrationTransientException ex5 = ex as MigrationTransientException; if (ex4 != null) { value = ex4.InternalError + ". "; } else if (ex5 != null) { value = ex5.InternalError + ". "; } StringBuilder stringBuilder = new StringBuilder(value); stringBuilder.Append(diagnosticInfo); stringBuilder.Append(ex.ToString()); return(AnchorLogger.SanitizeDiagnosticInfo(stringBuilder.ToString())); }
private static string GetDiagnosticInfo(MapiRetryableException e) { if (e.DiagCtx != null) { return(e.DiagCtx.ToCompactString()); } return(string.Empty); }
private string GetDiagnosticContext(Exception ex) { if (ex == null) { throw new ArgumentNullException("ex"); } string result = string.Empty; Exception innerException = ex.InnerException; MapiPermanentException ex2 = innerException as MapiPermanentException; MapiRetryableException ex3 = innerException as MapiRetryableException; if (ex2 != null) { result = ex2.DiagCtx.ToCompactString(); } else if (ex3 != null) { result = ex3.DiagCtx.ToCompactString(); } return(result); }
internal static string GetDiagnosticContext(Exception exception) { string result = string.Empty; while (exception != null) { MapiPermanentException ex = exception.InnerException as MapiPermanentException; if (ex != null) { result = ex.DiagCtx.ToCompactString(); break; } MapiRetryableException ex2 = exception.InnerException as MapiRetryableException; if (ex2 != null) { result = ex2.DiagCtx.ToCompactString(); break; } exception = exception.InnerException; } return(result); }
private static MessageStatus GetMessageStatus(IMessageConverter converter, StorageTransientException storageException) { StorageExceptionHandler.LogException(converter, storageException); if (storageException is MailboxInSiteFailoverException) { return(new MessageStatus(converter.IsOutbound ? MessageAction.Skip : MessageAction.Reroute, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); } if (storageException.InnerException != null) { MapiPermanentException ex = storageException.InnerException as MapiPermanentException; if (ex != null) { return(StorageExceptionHandler.GetMessageStatus <StorageTransientException>(converter, ex, storageException)); } MapiRetryableException ex2 = storageException.InnerException as MapiRetryableException; if (ex2 != null) { return(StorageExceptionHandler.GetMessageStatus <StorageTransientException>(converter, ex2, storageException)); } } return(new MessageStatus(MessageAction.Retry, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); }
private static MessageStatus GetMessageStatus(IMessageConverter converter, StoragePermanentException storageException) { StorageExceptionHandler.LogException(converter, storageException); ConversionFailedException ex = storageException as ConversionFailedException; if (ex != null) { return(StorageExceptionHandler.GetMessageStatus(converter, ex)); } if (storageException is MailboxCrossSiteFailoverException || storageException is MailboxInfoStaleException) { return(new MessageStatus(converter.IsOutbound ? MessageAction.Skip : MessageAction.Reroute, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, true), storageException)); } if (storageException is UnableToFindServerForDatabaseException || storageException is IllegalCrossServerConnectionException) { return(new MessageStatus(converter.IsOutbound ? MessageAction.Skip : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); } if (storageException.InnerException is CannotGetSiteInfoException) { return(new MessageStatus(converter.IsOutbound ? MessageAction.RetryMailboxServer : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException.InnerException, true), storageException)); } if (storageException.InnerException != null) { MapiPermanentException ex2 = storageException.InnerException as MapiPermanentException; if (ex2 != null) { return(StorageExceptionHandler.GetMessageStatus <StoragePermanentException>(converter, ex2, storageException)); } MapiRetryableException ex3 = storageException.InnerException as MapiRetryableException; if (ex3 != null) { return(StorageExceptionHandler.GetMessageStatus <StoragePermanentException>(converter, ex3, storageException)); } } return(new MessageStatus(MessageAction.NDR, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, true), storageException)); }
private static MessageStatus GetMessageStatus <T>(IMessageConverter converter, MapiRetryableException mapiException, T storageException) where T : Exception { string name = mapiException.GetType().Name; string key; MessageStatus messageStatus; switch (key = name) { case "MapiExceptionMailboxInTransit": case "MapiExceptionServerPaused": return(new MessageStatus(converter.IsOutbound ? MessageAction.Skip : MessageAction.Reroute, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); case "MapiExceptionDismountInProgress": return(new MessageStatus(converter.IsOutbound ? MessageAction.RetryQueue : MessageAction.Reroute, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); case "MapiExceptionLogonFailed": return(new MessageStatus(MessageAction.Retry, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.LogonFailure), storageException)); case "MapiExceptionJetErrorLogWriteFail": case "MapiExceptionJetErrorDiskIO": case "MapiExceptionJetErrorCheckpointDepthTooDeep": return(new MessageStatus(MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MailboxIOError), storageException)); case "MapiExceptionJetErrorInstanceUnavailable": return(new MessageStatus(MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MailboxIOError), storageException)); case "MapiExceptionNetworkError": messageStatus = new MessageStatus(MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MailboxServerOffline), storageException); messageStatus.RetryInterval = new TimeSpan?(StorageExceptionHandler.MailboxDeliveryFastQueueRetryInterval); return(messageStatus); case "MapiExceptionRpcServerTooBusy": case "MapiExceptionSessionLimit": case "MapiExceptionNotEnoughMemory": messageStatus = new MessageStatus(converter.IsOutbound ? MessageAction.RetryMailboxServer : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, name, false), storageException); messageStatus.RetryInterval = new TimeSpan?(StorageExceptionHandler.MailboxDeliveryFastQueueRetryInterval); return(messageStatus); case "MapiExceptionMaxThreadsPerMdbExceeded": messageStatus = new MessageStatus(MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MailboxServerMaxThreadsPerMdbExceeded), storageException); messageStatus.RetryInterval = new TimeSpan?(StorageExceptionHandler.MailboxDeliveryFastQueueRetryInterval); return(messageStatus); case "MapiExceptionMaxThreadsPerSCTExceeded": messageStatus = new MessageStatus(converter.IsOutbound ? MessageAction.Retry : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MapiExceptionMaxThreadsPerSCTExceeded), storageException); messageStatus.RetryInterval = new TimeSpan?(StorageExceptionHandler.MailboxDeliveryFastQueueRetryInterval); return(messageStatus); case "MapiExceptionRpcOutOfMemory": case "MapiExceptionRpcOutOfResources": case "MapiExceptionRpcServerOutOfMemory": case "MapiExceptionVersionStoreBusy": return(new MessageStatus(converter.IsOutbound ? MessageAction.Retry : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); case "MapiExceptionSubsystemStopping": return(new MessageStatus(converter.IsOutbound ? MessageAction.RetryMailboxServer : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); case "MapiExceptionLowDatabaseDiskSpace": case "MapiExceptionLowDatabaseLogDiskSpace": return(new MessageStatus(converter.IsOutbound ? MessageAction.Retry : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MailboxDiskFull), storageException)); case "MapiExceptionADNotFound": return(new MessageStatus(converter.IsOutbound ? MessageAction.RetryMailboxServer : MessageAction.RetryQueue, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false, AckReason.MailboxDiskFull), storageException)); case "MapiExceptionMailboxQuarantined": if (converter.IsOutbound) { return(new MessageStatus(MessageAction.Skip, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, true), storageException)); } return(new MessageStatus(MessageAction.NDR, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, true, AckReason.RecipientMailboxQuarantined), storageException)); case "MapiExceptionRetryableImportFailure": case "MapiExceptionBusy": case "MapiExceptionDiskError": case "MapiExceptionJetErrorOutOfBuffers": case "MapiExceptionJetErrorOutOfCursors": case "MapiExceptionJetErrorOutOfMemory": case "MapiExceptionJetErrorOutOfSessions": case "MapiExceptionJetErrorTooManyOpenTables": case "MapiExceptionJetErrorTooManyOpenTablesAndCleanupTimedOut": case "MapiExceptionJetErrorVersionStoreOutOfMemory": case "MapiExceptionJetErrorVersionStoreOutOfMemoryAndCleanupTimedOut": case "MapiExceptionNoFreeJses": case "MapiExceptionNotEnoughDisk": case "MapiExceptionTimeout": case "MapiExceptionWait": case "MapiExceptionCollision": return(new MessageStatus(MessageAction.Retry, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException)); } messageStatus = new MessageStatus(MessageAction.Retry, StorageExceptionHandler.GetExceptionSmtpResponse(converter, storageException, false), storageException); return(messageStatus); }
// Token: 0x06000F4E RID: 3918 RVA: 0x0005EC00 File Offset: 0x0005CE00 private void PrivateRegisterException(Exception innerException, Exception exceptionToLog, string serverFqdn) { Type type = innerException.GetType(); string text = type.FullName; MapiRetryableException ex = innerException as MapiRetryableException; if (ex != null && ex.DiagCtx != null && ex.DiagCtx.Length > 0) { for (int i = 0; i < ex.DiagCtx.Length; i++) { if (ex.DiagCtx[i].Layout != DiagRecordLayout.dwParam) { text = text + "+" + ex.DiagCtx[i].Lid; break; } } } if (!this.exceptionKeys.Contains(text)) { this.exceptionKeys.Add(text); } OwaExceptionEventManager.ExceptionInfo exceptionInfo; if (!this.exceptionInformation.TryGetValue(text, out exceptionInfo)) { exceptionInfo = new OwaExceptionEventManager.ExceptionInfo(); this.exceptionInformation.Add(text, exceptionInfo); } exceptionInfo.ExceptionObject = exceptionToLog; exceptionInfo.TotalCount++; if (exceptionInfo.PerServerCount.ContainsKey(serverFqdn)) { Dictionary <string, int> perServerCount; (perServerCount = exceptionInfo.PerServerCount)[serverFqdn] = perServerCount[serverFqdn] + 1; } else { exceptionInfo.PerServerCount.Add(serverFqdn, 1); } if (this.serverFqdns.ContainsKey(serverFqdn)) { SortedList <string, int> sortedList; (sortedList = this.serverFqdns)[serverFqdn] = sortedList[serverFqdn] + 1; } else { this.serverFqdns.Add(serverFqdn, 1); } this.totalExceptionCount++; DateTime utcNow = DateTime.UtcNow; OwaExceptionEventManager.ExceptionTimingInfo exceptionTimingInfo; if (this.exceptionTimingSlots.Count == 0 || utcNow > this.exceptionTimingSlots[this.exceptionTimingSlots.Count - 1].EndTime) { exceptionTimingInfo = new OwaExceptionEventManager.ExceptionTimingInfo(); exceptionTimingInfo.StartTime = utcNow; exceptionTimingInfo.EndTime = utcNow.AddSeconds(60.0); exceptionTimingInfo.Count = 0; this.exceptionTimingSlots.Add(exceptionTimingInfo); } else { exceptionTimingInfo = this.exceptionTimingSlots[this.exceptionTimingSlots.Count - 1]; } if (exceptionTimingInfo.HitsPerExceptionType.ContainsKey(text)) { Dictionary <string, int> hitsPerExceptionType; string key; (hitsPerExceptionType = exceptionTimingInfo.HitsPerExceptionType)[key = text] = hitsPerExceptionType[key] + 1; } else { exceptionTimingInfo.HitsPerExceptionType.Add(text, 1); } exceptionTimingInfo.Count++; }