Ran*_*der 19 c# multithreading exception-handling exception task
我一直在查看我们的一个应用程序中的一些代码,如下所示:
catch (AggregateException ae)
{
this._logger.Log(ae.Flatten().InnerException.ToString(), Category.Exception, Priority.High);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是这个.我知道是什么AggregateException.Flatten(),我知道AggregateException.Flatten().InnerExceptions代表什么.但是,AggregateException.Flatten().InnerException(单个)代表什么?
Jon*_*eet 37
它只是原始异常中的非AggregateExceptions 之一.例如,如果你有一个首字母AggregateException:
AggregateException
AggregateException
IOException("x")
IOException("y")
IOException("z")
Run Code Online (Sandbox Code Playgroud)
然后InnerException扁平结果会出来为两种IOException("x"),IOException("y")或IOException("z").我不相信有任何保证其中的那样.(我认为目前的行为会带来的"Z"版本此刻...)这将是第一的InnerExceptions,变平的版本,但应该被看作是联盟所有原非AggregateExceptions的,没有保证订单.
基本上InnerException不是非常有用AggregateException.这将是迄今为止记录更多有用所有的InnerExceptions...或者只是调用ToString()的顶层例外,这将让所有的结构...
| 归档时间: |
|
| 查看次数: |
8819 次 |
| 最近记录: |