internal static BadMessageRec Item(MessageRec msgData, FolderRec folderRec, Exception exception) { BadMessageRec badMessageRec = new BadMessageRec(); if (exception == null) { badMessageRec.Kind = BadItemKind.MissingItem; } else if (CommonUtils.ExceptionIs(exception, new WellKnownException[] { WellKnownException.MapiMaxSubmissionExceeded })) { badMessageRec.Kind = BadItemKind.LargeItem; } else { badMessageRec.Kind = BadItemKind.CorruptItem; } badMessageRec.EntryId = msgData.EntryId; badMessageRec.Sender = (msgData[PropTag.SenderName] as string); badMessageRec.Recipient = (msgData[PropTag.ReceivedByName] as string); badMessageRec.Subject = (msgData[PropTag.Subject] as string); badMessageRec.MessageClass = (msgData[PropTag.MessageClass] as string); badMessageRec.MessageSize = (int?)msgData[PropTag.MessageSize]; badMessageRec.DateSent = (DateTime?)msgData[PropTag.ClientSubmitTime]; badMessageRec.DateReceived = (DateTime?)msgData[PropTag.MessageDeliveryTime]; badMessageRec.FolderId = msgData.FolderId; badMessageRec.FolderName = folderRec.FolderName; badMessageRec.Failure = FailureRec.Create(exception); badMessageRec.RawFailure = exception; return(badMessageRec); }
public void Append(LocalizedString msg, Exception failure, ReportEntryFlags flags) { this.Append(new ReportEntry(msg, ReportEntryType.Error) { Failure = FailureRec.Create(failure), Flags = (flags | ReportEntryFlags.Failure) }); }
public void Append(LocalizedString msg, FailureRec failureRec, ReportEntryFlags flags) { this.Append(new ReportEntry(msg, ReportEntryType.Error) { Failure = failureRec, Flags = (flags | ReportEntryFlags.Failure) }); }
public IDictionary <Guid, FailureRec> GetQuarantinedJobs() { IRegistryReader instance = RegistryReader.Instance; IRegistryWriter instance2 = RegistryWriter.Instance; string[] array = null; try { array = instance.GetSubKeyNames(Registry.LocalMachine, JobQuarantineProvider.KeyNameFormatQuarantinedJobRoot); } catch (ArgumentException) { } if (array == null) { return(new Dictionary <Guid, FailureRec>()); } Dictionary <Guid, FailureRec> dictionary = new Dictionary <Guid, FailureRec>(array.Length); string[] array2 = array; int i = 0; while (i < array2.Length) { string text = array2[i]; Guid key = Guid.Empty; string subkeyName = Path.Combine(JobQuarantineProvider.KeyNameFormatQuarantinedJobRoot, text); try { key = new Guid(text); } catch (FormatException) { try { instance2.DeleteSubKeyTree(Registry.LocalMachine, subkeyName); } catch (ArgumentException) { } goto IL_118; } goto IL_80; IL_118: i++; continue; IL_80: string value = instance.GetValue <string>(Registry.LocalMachine, subkeyName, "FailureType", string.Empty); string value2 = instance.GetValue <string>(Registry.LocalMachine, subkeyName, "Message", string.Empty); string value3 = instance.GetValue <string>(Registry.LocalMachine, subkeyName, "StackTrace", string.Empty); string value4 = instance.GetValue <string>(Registry.LocalMachine, subkeyName, "DataContext", string.Empty); string value5 = instance.GetValue <string>(Registry.LocalMachine, subkeyName, "InnerException", string.Empty); FailureRec value6 = FailureRec.Create(value, value2, value3, value4, value5); dictionary.Add(key, value6); goto IL_118; } return(dictionary); }
internal static BadMessageRec MissingItem(Exception ex) { return(new BadMessageRec { Kind = BadItemKind.MissingItem, Failure = FailureRec.Create(ex), EntryId = BadMessageRec.ComputeKey(BitConverter.GetBytes(ex.GetHashCode()), BadItemKind.MissingItem) }); }
internal static BadMessageRec InferenceData(Exception failure, byte[] entryId) { return(new BadMessageRec { Kind = BadItemKind.CorruptInferenceProperties, Failure = FailureRec.Create(failure), EntryId = entryId, RawFailure = failure }); }
internal static BadMessageRec MailboxSetting(Exception failure, ItemPropertiesBase item) { return(new BadMessageRec { Kind = BadItemKind.CorruptMailboxSetting, Failure = FailureRec.Create(failure), RawFailure = failure, MessageClass = item.GetType().ToString(), EntryId = item.GetId() }); }
internal static BadMessageRec Folder(FolderRec folderRec, BadItemKind kind, Exception failure) { return(new BadMessageRec { Kind = kind, EntryId = BadMessageRec.ComputeKey(folderRec.EntryId, kind), FolderId = folderRec.EntryId, FolderName = folderRec.FolderName, Failure = FailureRec.Create(failure), RawFailure = failure }); }
public static void Add(Guid requestGuid, Exception ex) { if (!QuarantinedJobs.Enabled) { return; } JobQuarantineProvider.Instance.QuarantineJob(requestGuid, ex); lock (QuarantinedJobs.syncRoot) { QuarantinedJobs.Jobs.Add(requestGuid, FailureRec.Create(ex)); } }
public ReportEntry(LocalizedString message, ReportEntryType type, Exception failure, ReportEntryFlags flags) { this.Message = message; this.CreationTime = (DateTime)ExDateTime.UtcNow; this.ServerName = CommonUtils.LocalShortComputerName; this.Type = type; this.Flags = flags; if (failure != null) { this.Failure = FailureRec.Create(failure); this.Flags |= ReportEntryFlags.Failure; } }
private FailureRec(Exception ex) { this.Timestamp = DateTime.UtcNow; this.FailureType = CommonUtils.GetFailureType(ex); this.FailureCode = CommonUtils.HrFromException(ex); this.MapiLowLevelError = CommonUtils.GetMapiLowLevelError(ex); this.FailureSide = CommonUtils.GetExceptionSide(ex); this.ExceptionTypes = CommonUtils.ClassifyException(ex); this.Message = CommonUtils.FullExceptionMessage(ex).ToString(); this.DataContext = ExecutionContext.GetDataContext(ex); this.StackTrace = CommonUtils.GetStackTrace(ex); this.InnerException = FailureRec.Create(ex.InnerException); }
internal static BadMessageRec FolderProperty(FolderRec folderRec, PropTag propTag, string sourceValue, string destValue) { BadMessageRec badMessageRec = new BadMessageRec(); badMessageRec.FolderId = folderRec.EntryId; badMessageRec.FolderName = folderRec.FolderName; badMessageRec.Kind = BadItemKind.FolderPropertyMismatch; badMessageRec.EntryId = BadMessageRec.ComputeKey(folderRec.EntryId, badMessageRec.Kind, propTag); PropertyMismatchException ex = new PropertyMismatchException((uint)propTag, sourceValue, destValue); badMessageRec.Failure = FailureRec.Create(ex); badMessageRec.RawFailure = ex; return(badMessageRec); }
protected override RequestState RelinquishAction(TransactionalRequestJob requestJob, ReportData report) { FailureRec failureRec = QuarantinedJobs.Get(base.RequestGuid); if (failureRec == null) { return(RequestState.Relinquished); } report.Append(MrsStrings.JobIsQuarantined, failureRec, ReportEntryFlags.Fatal); requestJob.Suspend = true; requestJob.Status = RequestStatus.Failed; requestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.Failure, new DateTime?(DateTime.UtcNow)); QuarantinedJobs.Remove(base.RequestGuid); RequestJobLog.Write(requestJob); return(RequestState.Failed); }
public static FailureRec Get(Guid requestGuid) { if (!QuarantinedJobs.Enabled) { return(null); } FailureRec result; lock (QuarantinedJobs.syncRoot) { FailureRec failureRec = null; QuarantinedJobs.Jobs.TryGetValue(requestGuid, out failureRec); result = failureRec; } return(result); }
void IDataImport.SendMessage(IDataMessage message) { MessageExportResultsMessage messageExportResultsMessage = message as MessageExportResultsMessage; if (messageExportResultsMessage == null) { base.WrappedObject.SendMessage(message); return; } this.MissingMessages = messageExportResultsMessage.MissingMessages; this.BadMessages = messageExportResultsMessage.BadMessages; foreach (BadMessageRec badMessageRec in this.BadMessages) { badMessageRec.Failure = FailureRec.Create(new RemotePermanentException(new LocalizedString(badMessageRec.XmlData), null)); } }
public void QuarantineJob(Guid requestGuid, Exception ex) { try { FailureRec failureRec = FailureRec.Create(ex); string subkeyName = string.Format(JobQuarantineProvider.KeyNameFormatQuarantinedJob, requestGuid); RegistryWriter.Instance.CreateSubKey(Registry.LocalMachine, subkeyName); RegistryWriter.Instance.SetValue(Registry.LocalMachine, subkeyName, "FailureType", failureRec.FailureType ?? string.Empty, RegistryValueKind.String); RegistryWriter.Instance.SetValue(Registry.LocalMachine, subkeyName, "Message", failureRec.Message ?? string.Empty, RegistryValueKind.String); RegistryWriter.Instance.SetValue(Registry.LocalMachine, subkeyName, "StackTrace", failureRec.StackTrace ?? string.Empty, RegistryValueKind.String); string dataContext = failureRec.DataContext ?? string.Empty; RegistryWriter.Instance.SetValue(Registry.LocalMachine, subkeyName, "DataContext", FailureLog.GetDataContextToPersist(dataContext), RegistryValueKind.String); string text = string.Empty; if (failureRec.InnerException != null) { text = failureRec.InnerException.StackTrace; } RegistryWriter.Instance.SetValue(Registry.LocalMachine, subkeyName, "InnerException", text ?? string.Empty, RegistryValueKind.String); } catch (ArgumentException) { } }
public static FailureRec Create(string failureType, string message, string stackTrace, string dataContext, string innerException) { FailureRec innerFailure = string.IsNullOrEmpty(innerException) ? null : FailureRec.Create(string.Empty, string.Empty, innerException, string.Empty, string.Empty); return(new FailureRec(failureType, message, stackTrace, dataContext, innerFailure)); }
private FailureRec(string failureType, string message, string stackTrace, string dataContext, FailureRec innerFailure) { this.Timestamp = DateTime.UtcNow; this.FailureType = failureType; this.FailureCode = 0; this.MapiLowLevelError = 0; this.FailureSide = null; WellKnownException[] exceptionTypes = new WellKnownException[1]; this.ExceptionTypes = exceptionTypes; this.Message = message; this.StackTrace = stackTrace; this.DataContext = dataContext; if (innerFailure != null) { this.InnerException = innerFailure; } }