This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Show nested exceptions more clearly #25045
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4cb6fba
Change ArgumentException message to one line
danmoseley 3572733
Extract common code to Exception
danmoseley c32b26a
Prefix inner exception string
danmoseley b0dd864
Attempt to clean up AE
danmoseley 85fd408
Remove EDI boundary?
danmoseley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -440,26 +440,14 @@ public override string Message | |
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Creates and returns a string representation of the current <see cref="AggregateException"/>. | ||
| /// </summary> | ||
| /// <returns>A string representation of the current exception.</returns> | ||
| public override string ToString() | ||
| protected internal override string InnerExceptionToString(Exception? inner = null) | ||
| { | ||
| StringBuilder text = new StringBuilder(); | ||
| text.Append(base.ToString()); | ||
|
|
||
| for (int i = 0; i < m_innerExceptions.Count; i++) | ||
| var sb = new StringBuilder(); | ||
| foreach(Exception ex in m_innerExceptions) | ||
| { | ||
| text.AppendLine(); | ||
| text.Append("---> "); | ||
| text.AppendFormat(CultureInfo.InvariantCulture, SR.AggregateException_InnerException, i); | ||
| text.Append(m_innerExceptions[i].ToString()); | ||
| text.Append("<---"); | ||
| text.AppendLine(); | ||
| sb.Append(base.InnerExceptionToString(ex)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having removed all of the separators, what does an AggregateException now look like?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See example linked in top post. I can also add one with an AggE wrapping an AggE. |
||
| } | ||
|
|
||
| return text.ToString(); | ||
| return sb.ToString(); | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not unusual for folks to have parser of the
Exception.ToStringmessage - to reformat it or to identify root cause. Here is an example found by a quick github search:https://github.com/pieceofsummer/Hangfire.StackTrace/blob/45ced0e988bee23f86d71c2fa60997b9210f677a/src/Hangfire.StackTrace/FailedStateRenderer.cs#L146
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant we just enable that through configuration. In that way, people can start preparing for it, like it was done with tiered JIT.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved part into #25185 for 3.0, and will pick this up again when master is open for .NET 5.