Show nested exceptions more clearly#25045
Conversation
|
Can you share an example of what this looks like when one or more of the exceptions have been propagated multiple times via ExceptionDispatchInfo.Throw? |
| text.Append(m_innerExceptions[i].ToString()); | ||
| text.Append("<---"); | ||
| text.AppendLine(); | ||
| sb.Append(base.InnerExceptionToString(ex)); |
There was a problem hiding this comment.
Having removed all of the separators, what does an AggregateException now look like?
There was a problem hiding this comment.
See example linked in top post. I can also add one with an AggE wrapping an AggE.
As you saw, I didn't change that banner: eg It is a bit distracting from the stack itself, though. I wonder whether the text is necessary or useful. Would this be an improvement? Or, is the Edit: pushed up the change to remove the boundary for discussion sake. |
| <data name="EventSource_VarArgsParameterMismatch" xml:space="preserve"> | ||
| <value>The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly.</value> | ||
| </data> | ||
| <data name="Exception_EndOfInnerExceptionStack" xml:space="preserve"> |
There was a problem hiding this comment.
It is not unusual for folks to have parser of the Exception.ToString message - to reformat it or to identify root cause. Here is an example found by a quick github search:
This change is likely going to break these ... that may be ok, but we do not have much time to react to feedback in 3.0.
There was a problem hiding this comment.
Cant we just enable that through configuration. In that way, people can start preparing for it, like it was done with tiered JIT.
There was a problem hiding this comment.
We have used AppContext switches less than a dozen times in .NET Core so far. If it is a temporary thing we take out after 3.0 then I do not object. I can use a switch to hide most of this just for a few weeks. Of course that means that few if anyone "benefits" from this in 3.0.
Another option is that I keep the changes to put messages on their own lines, and to avoid duplicating the first inner exception in the AggregateException, but defer the change to indent and defer removing the two dividers.
thoughts?
There was a problem hiding this comment.
I moved part into #25185 for 3.0, and will pick this up again when master is open for .NET 5.
|
I'll merge and finish this later for 5.0 |
Possible fix for https://github.com/dotnet/corefx/issues/37816
Changes made
Did not change
Examples
Should change this from #37815 into more like this which removes duplication and draws the eye to the innermost exception, which in this case is the root cause.
Also this from #38293 to this. Again, half as long and it's easy to see which stack goes with which message.
Output of this test program was this is now this.
Thoughts?