Reputation: 533
If I have an exception ex that is not an aggregate exception, can the inner exception of ex be an aggregate exception.
Similarly, can the inner exceptions of an aggregate exceptions be aggregate exceptions?
I've been trying to learn about aggregate exceptions, and haven't come across the above use cases so wasn't sure if they even make sense conceptually.
Upvotes: 0
Views: 357
Reputation: 36361
yes and yes. For aggregate exceptions with inner aggregate exceptions there is the .Flatten()
method that returns an aggregate exception with a InnerExceptions that lists all the inner exceptions.
However, aggregate exceptions are mostly encountered when managing tasks manually. If you stick to using async-await there is a less chance that you need to deal with this.
Upvotes: 1