public static void SendWatsonReport(Exception e, string taskName, PropertyBag boundParameters) { TaskLogger.StopFileLogging(); bool flag = true; try { string sourceFileName = Path.Combine(ConfigurationContext.Setup.SetupLoggingPath, ConfigurationContext.Setup.SetupLogFileName); string text = Path.Combine(ConfigurationContext.Setup.SetupLoggingPath, ConfigurationContext.Setup.SetupLogFileNameForWatson); File.Copy(sourceFileName, text, true); int num = 0; while (!ExWatson.TryAddExtraFile(text) && num < 10) { Thread.Sleep(100); num++; } } catch (FileNotFoundException) { } catch (DirectoryNotFoundException) { } catch (IOException) { flag = false; if (TaskLogger.IsFileLoggingEnabled) { TaskLogger.LogErrorString(Strings.ExchangeSetupCannotCopyWatson(ConfigurationContext.Setup.SetupLogFileName, ConfigurationContext.Setup.SetupLogFileNameForWatson)); } } if (flag) { if (!string.IsNullOrEmpty(taskName)) { ExWatson.AddExtraData("Task Name: " + taskName); } if (boundParameters != null) { StringBuilder stringBuilder = new StringBuilder("Parameters:\n"); foreach (object obj in boundParameters) { DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; if (dictionaryEntry.Value is IList) { stringBuilder.AppendLine(string.Format("{0}:{1}", dictionaryEntry.Key, MultiValuedPropertyBase.FormatMultiValuedProperty(dictionaryEntry.Value as IList))); } else { stringBuilder.AppendLine(string.Format("{0}:'{1}'", dictionaryEntry.Key, (dictionaryEntry.Value == null) ? "<null>" : dictionaryEntry.Value.ToString())); } } ExWatson.AddExtraData(stringBuilder.ToString()); } ExWatson.SendReport(e, ReportOptions.DoNotFreezeThreads, null); } try { TaskLogger.ResumeFileLogging(); } catch (IOException) { if (TaskLogger.IsFileLoggingEnabled) { TaskLogger.LogErrorString(Strings.ExchangeSetupCannotResumeLog(ConfigurationContext.Setup.SetupLogFileName)); } throw; } }
internal static PropertyConstraintViolationError ValidateCapabilities(IEnumerable collection, PropertyDefinition propertyDefinition, IPropertyBag propertyBag, PropertyDefinitionConstraint owner) { if (collection == null) { return(null); } List <Capability> list = new List <Capability>(); foreach (object obj in collection) { Capability capability = (Capability)obj; if (capability == Capability.None) { return(new PropertyConstraintViolationError(DirectoryStrings.ErrorCapabilityNone, propertyDefinition, obj, owner)); } if (CapabilityHelper.IsRootSKUCapability(capability)) { list.Add(capability); } } if (list.Count > 1) { return(new PropertyConstraintViolationError(DirectoryStrings.ErrorMoreThanOneSKUCapability(MultiValuedPropertyBase.FormatMultiValuedProperty(list)), propertyDefinition, collection, owner)); } return(null); }
protected string FormatMultiValuedProperty(IList mvp) { return(MultiValuedPropertyBase.FormatMultiValuedProperty(mvp)); }
protected void SaveDerivedRoleAndWarnOnValidationErrors(ExchangeRole role) { if (role.IsRootRole) { throw new ArgumentNullException("Only derive roles should be"); } try { int count = role.RoleEntries.Count; ValidationError[] array = role.Validate(); role.AllowEmptyRole = true; this.settings.ConfigurationSession.Save(role); this.settings.LogWriteObject(role); this.settings.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(role, this.settings.ConfigurationSession, typeof(ExchangeRole))); if (array != null && array.Length != 0) { this.settings.WriteWarning(Strings.WarningInvalidRoleAfterUpgrade(role.Identity.ToString(), MultiValuedPropertyBase.FormatMultiValuedProperty(array))); } } catch (DataSourceOperationException ex) { this.settings.WriteWarning(Strings.WarningCannotUpgradeRole(role.Identity.ToString(), ex.Message)); } catch (DataValidationException ex2) { this.settings.WriteWarning(Strings.WarningCannotUpgradeRole(role.Identity.ToString(), ex2.Message)); } }