当前位置: 首页>>代码示例>>C#>>正文


C# AggregateException.Flatten方法代码示例

本文整理汇总了C#中System.AggregateException.Flatten方法的典型用法代码示例。如果您正苦于以下问题:C# AggregateException.Flatten方法的具体用法?C# AggregateException.Flatten怎么用?C# AggregateException.Flatten使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.AggregateException的用法示例。


在下文中一共展示了AggregateException.Flatten方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: concatMessages

 private static String concatMessages(AggregateException ae)
 {
     if (ae == null)
     {
         return "";
     }
     var flattened = ae.Flatten();
     return String.Join("\n\n", from exc in flattened.InnerExceptions
         select getExceptionMessages("", exc));
 }
开发者ID:xebialabs-community,项目名称:xld-manifest-editor,代码行数:10,代码来源:DeployitServerConnectionException.cs

示例2: GetAggrateException

        internal static string GetAggrateException(AggregateException ex)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine(string.Join("  ",
                    ex.Message,
                    ex.StackTrace));

            foreach (var innerEx in ex.Flatten().InnerExceptions)
            {
                sb.AppendLine(GetExceptionString(ex));
            }
            return sb.ToString();
        }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:13,代码来源:LogWriter.cs

示例3: ParseExceptionMessage

 private static void ParseExceptionMessage(StringBuilder sb, AggregateException aex)
 {
     if (aex != null)
     {
         ParseCommonExceptionMessage(sb, aex);
         sb.AppendLine();
         sb.AppendLine();
         sb.AppendLine("InnerExceptions :");
         sb.Append("===============================");
         aex.Flatten().Handle((ex) =>
         {
             ParseAllExceptionMessage(sb, ex);
             sb.AppendLine();
             return true;
         });
     }
 }
开发者ID:deboe2015,项目名称:Ctrip.SOA,代码行数:17,代码来源:ExceptionHelper.cs

示例4: FinishRebuildAll

        public void FinishRebuildAll(TaskStatus status, AggregateException exception)
        {
            _writeline($"Finished RebuildAll with status {status}");
            if (exception != null)
            {
                var flattened = exception.Flatten();

                foreach (var ex in flattened.InnerExceptions)
                {
                    _writeline("");
                    _writeline("---------");
                    _writeline("Exception:");
                    _writeline("---------");
                    _writeline(ex.ToString());
                    _writeline("");
                }
            }
        }
开发者ID:danielmarbach,项目名称:marten,代码行数:18,代码来源:TracingLogger.cs

示例5: AddProblem

        public NugetProblem AddProblem(AggregateException aggregate)
        {
            var message = "Fatal error";
            Exception exception = aggregate;
            if (aggregate != null)
            {
                exception = aggregate.Flatten();
                message = exception.Message;

                if (exception.InnerException != null)
                {
                    exception = exception.InnerException;
                    message = exception.Message;
                }
            }

            var problem = new NugetProblem(message, exception);
            AddProblem(problem);

            return problem;
        }
开发者ID:modulexcite,项目名称:ripple,代码行数:21,代码来源:NugetResult.cs

示例6: Flatten

        public static void Flatten()
        {
            Exception exceptionA = new Exception("A");
            Exception exceptionB = new Exception("B");
            Exception exceptionC = new Exception("C");

            AggregateException aggExceptionBase = new AggregateException(exceptionA, exceptionB, exceptionC);

            // Verify flattening one with another.
            // > Flattening (no recursion)...

            AggregateException flattened1 = aggExceptionBase.Flatten();
            Exception[] expected1 = new Exception[] {
                exceptionA, exceptionB, exceptionC
            };

            Assert.Equal(expected1, flattened1.InnerExceptions);

            // Verify flattening one with another, accounting for recursion.
            AggregateException aggExceptionRecurse = new AggregateException(aggExceptionBase, aggExceptionBase);
            AggregateException flattened2 = aggExceptionRecurse.Flatten();
            Exception[] expected2 = new Exception[] {
                exceptionA, exceptionB, exceptionC, exceptionA, exceptionB, exceptionC,
            };

            Assert.Equal(expected2, flattened2.InnerExceptions);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:27,代码来源:AggregateExceptionTests.cs

示例7: FileErrored

 private void FileErrored(ProcessingFile processingFile, AggregateException exception)
 {
     Logger.Error(string.Format("File processing failed: {0}", processingFile.OriginalFilePath), exception.Flatten());
     this.processResultHandler.Handle(FileProcessResult.Error, processingFile);
 }
开发者ID:RustyF,项目名称:EnergyTrading-Core,代码行数:5,代码来源:FileProducerConsumerQueue.cs

示例8: FindException

        static Exception FindException(AggregateException exception) {
            foreach (var e in exception.Flatten().InnerExceptions) {
                if (e is Win32Exception)
                    return e;

                var ce = e as CompositionException;
                if (ce != null) {
                    var found = FindException(ce);
                    if (found != null)
                        return found;
                }

                if (!(e is XamlException))
                    continue;

                var inner = e.FindInnerException<Win32Exception>();
                if (inner != null)
                    return inner;
            }
            return null;
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:21,代码来源:PlayShellView.xaml.cs

示例9: PrintAggregateException

 /// <summary>
 /// Processes all exceptions inside an <see cref="AggregateException"/> and writes each inner exception to the console.
 /// </summary>
 /// <param name="aggregateException">The <see cref="AggregateException"/> to process.</param>
 public static void PrintAggregateException(AggregateException aggregateException)
 {
     // Flatten the aggregate and iterate over its inner exceptions, printing each
     foreach (Exception exception in aggregateException.Flatten().InnerExceptions)
     {
         Console.WriteLine(exception.ToString());
         Console.WriteLine();
     }
 }
开发者ID:paselem,项目名称:azure-batch-samples,代码行数:13,代码来源:Program.cs

示例10: DumpException

        private static void DumpException(AggregateException ex, StreamWriter sw, string header)
        {
            AggregateException flat = ex.Flatten();
            
            if (header != null)
            {
                sw.WriteLine("Custom header message:");
                sw.WriteLine(header);
                sw.WriteLine("---");
            }

            sw.WriteLine("Aggregate Exception: " + ex.Message);
            sw.WriteLine("---");

            foreach (Exception eo in ex.InnerExceptions)
            {
                DumpException(eo, sw, null);
            }
        }
开发者ID:WFoundation,项目名称:WF.Player.WinPhone,代码行数:19,代码来源:DebugUtils.cs

示例11: HandleException

 /// <summary>
 /// Exception handler for the connection class
 /// </summary>
 /// <param name="exception"></param>
 public static void HandleException(AggregateException exception)
 {
     if (exception == null) return;
     foreach (var ex in exception.Flatten().InnerExceptions)
     {
         Log(ex.StackTrace);
     }
 }
开发者ID:Citidel,项目名称:edgebot,代码行数:12,代码来源:Utils.cs


注:本文中的System.AggregateException.Flatten方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。