Example #1
0
        protected void SaveRoleAndSuggestCleanupOnFailure(ExchangeRole role)
        {
            Exception ex = null;

            try
            {
                this.settings.ConfigurationSession.Save(role);
                this.settings.LogWriteObject(role);
                this.settings.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(role, this.settings.ConfigurationSession, typeof(ExchangeRole)));
            }
            catch (DataSourceOperationException ex2)
            {
                ex = ex2;
            }
            catch (DataValidationException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                CorruptedRoleNeedsCleanupException ex4 = new CorruptedRoleNeedsCleanupException(role.Identity.ToString(), ex.Message, ex);
                if (!this.settings.Task.Stopping)
                {
                    TaskLogger.SendWatsonReport(ex4);
                }
                this.settings.WriteError(ex4, ErrorCategory.InvalidOperation, null);
            }
        }
Example #2
0
 internal void RemoveProductCode(Guid productCode)
 {
     TaskLogger.LogEnter();
     base.SetLogging();
     try
     {
         MsiUtility.PushExternalUI(base.UIHandler, (InstallLogMode)10115);
         try
         {
             string text = productCode.ToString("B").ToUpper(CultureInfo.InvariantCulture);
             base.WriteVerbose(Strings.RemovingPackageByProductCode(productCode));
             uint num = MsiNativeMethods.ConfigureProduct(text, InstallLevel.Default, InstallState.Default, base.PropertyValues);
             if (num != 0U)
             {
                 Win32Exception ex = new Win32Exception((int)num);
                 if (num == 3010U)
                 {
                     if (this.WarnOnRebootRequests)
                     {
                         TaskException ex2 = new TaskException(Strings.MsiRebootRequiredToFinish(text), ex);
                         TaskLogger.SendWatsonReport(ex2);
                         base.WriteWarning(ex2.Message);
                     }
                     else if (UninstallMsi.rebootRequiredException == null)
                     {
                         UninstallMsi.rebootRequiredException = new TaskException(Strings.MsiRebootRequiredToContinue(text), ex);
                     }
                 }
                 else if (string.IsNullOrEmpty(base.LastMsiError))
                 {
                     base.WriteError(new TaskException(Strings.MsiCouldNotRemoveProduct(productCode, ex.Message, (int)num), ex), ErrorCategory.InvalidOperation, null);
                 }
                 else
                 {
                     base.WriteError(new TaskException(Strings.MsiCouldNotRemoveProductDetailed(productCode, ex.Message, (int)num, base.LastMsiError), ex), ErrorCategory.InvalidOperation, null);
                 }
             }
         }
         finally
         {
             MsiUtility.PopExternalUI();
         }
     }
     catch (ArgumentOutOfRangeException exception)
     {
         base.WriteError(exception, ErrorCategory.InvalidArgument, 0);
     }
     TaskLogger.LogExit();
 }