想象一下这个场景:
Task.Run(() => { // code... }).ContinueWith(x => { var betterEx = new Exception("My custom message", x.Exception)); } , TaskContinuationOptions.OnlyOnFaulted);
然而 betterEx.InnerException null .
betterEx.InnerException
null
new Exception 然后传球 AggregateException
new Exception
AggregateException