private static bool HandleAssemblyUpdaterErrors(IEnumerable <AssemblyUpdaterUpdateTask> allTasks) { var tasksWithErrors = allTasks.Where(t => APIUpdaterAssemblyHelper.IsError(t.Result) || t.Exception != null); if (!tasksWithErrors.Any()) { return(false); } var sb = new StringBuilder(L10n.Tr("Unable to update following assemblies:")); foreach (var updaterTask in tasksWithErrors) { sb.AppendFormat("{1} (Name = {2}, Error = {3}) (Output: {4}){0}{5}{0}{6}{0}", Environment.NewLine, updaterTask.Candidate.Path, updaterTask.Candidate.Name, updaterTask.Result, updaterTask.OutputPath, updaterTask.StdOut, updaterTask.StdErr); if (updaterTask.Exception != null) { sb.AppendFormat("\tException: {0}{1}", updaterTask.Exception, Environment.NewLine); } } ReportIgnoredAssembliesDueToPreviousErrors(sb, allTasks.Except(tasksWithErrors)); APIUpdaterLogger.WriteErrorToConsole(sb.ToString()); return(true); }
private static void LogTimeoutError(AssemblyUpdaterCheckAssemblyPublishConfigsTask[] tasks, TimeSpan waitedTime) { var timedOut = tasks.Where(t => !t.Event.WaitOne(0)); var sb = new StringBuilder(L10n.Tr("Timeout while checking assemblies:")); foreach (var task in timedOut) { sb.AppendFormat("{1}{0}", Environment.NewLine, task.Candidate.Path); } sb.AppendFormat(L10n.Tr("{0}Timeout: {1} ms"), Environment.NewLine, waitedTime.Milliseconds); sb.AppendFormat(L10n.Tr("{0}Update configurations from those assemblies may have not been applied."), Environment.NewLine); APIUpdaterLogger.WriteErrorToConsole(sb.ToString()); }
private static void LogTimeoutError(AssemblyUpdaterUpdateTask[] tasks) { var completedSuccessfully = tasks.Where(t => t.Event.WaitOne(0)); var timedout = tasks.Where(t => !t.Event.WaitOne(0)); var sb = new StringBuilder(L10n.Tr("Timeout while updating assemblies:")); foreach (var updaterTask in timedout) { sb.AppendFormat("{1} (Output: {2}){0}", Environment.NewLine, updaterTask.Candidate.Path, updaterTask.OutputPath); } ReportIgnoredAssembliesDueToPreviousErrors(sb, completedSuccessfully); APIUpdaterLogger.WriteErrorToConsole(sb.ToString()); }
private static bool HandleCheckAssemblyPublishUpdaterConfigErrors(AssemblyUpdaterCheckAssemblyPublishConfigsTask[] nonTimedOutTasks) { var withErrors = nonTimedOutTasks.Where(t => APIUpdaterAssemblyHelper.IsError(t.Result) || t.Exception != null); if (!withErrors.Any()) { return(false); } var sb = new StringBuilder(L10n.Tr("Failed to check following assemblies for updater configurations:\r\n")); foreach (var failledAssemblyInfo in withErrors) { sb.AppendFormat(L10n.Tr("{0} (ret = {1}):\r\n{2}\r\n{3}\r\n"), failledAssemblyInfo.Candidate.Path, failledAssemblyInfo.Result, failledAssemblyInfo.StdOut, failledAssemblyInfo.StdErr); } sb.Append("\r\n--------------"); APIUpdaterLogger.WriteErrorToConsole(sb.ToString()); return(true); }
private static bool HandleAssemblyUpdaterErrors(IEnumerable <AssemblyUpdaterUpdateTask> allTasks) { var tasksWithErrors = allTasks.Where(t => APIUpdaterAssemblyHelper.IsError(t.Result) || APIUpdaterAssemblyHelper.IsUnknown(t.Result) || t.Exception != null); if (!tasksWithErrors.Any()) { return(false); } var sb = new StringBuilder(L10n.Tr("Unable to update following assemblies:")); foreach (var updaterTask in tasksWithErrors) { sb.Append(FormatErrorFromTask(updaterTask)); } ReportIgnoredAssembliesDueToPreviousErrors(sb, allTasks.Except(tasksWithErrors)); APIUpdaterLogger.WriteErrorToConsole(sb.ToString()); return(true); }