Skip to content

AggregateException.ToString() prints terrible message #28695

@Denis535

Description

@Denis535

Let's throw )

throw new AggregateException(
    "Error",
    new Exception( "Error 1" ),
    new AggregateException( "Error 2", new Exception( "Error 3" ) ) );

If we catch and print this exception then we get a such message:

System.AggregateException: Error (Error 1) (Error 2 (Error 3)) ---> System.Exception: Error 1
   --- End of inner exception stack trace ---
   at ConsoleApp2.Program.Main(String[] args) in C:\Users\Den\Desktop\ConsoleApp2\ConsoleApp2\Program.cs:line 17
---> (Inner Exception #0) System.Exception: Error 1<---

---> (Inner Exception dotnet/corefx#1) System.AggregateException: Error 2 (Error 3) ---> System.Exception: Error 3
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Exception: Error 3<---
<---

May be for you it's good format, but in my opinion it is terrible.
I'd like to see something like following:

 System.AggregateException: Error
 stack-trace ...
 |-- System.Exception: Error 1
 |   stack-trace ...
 |-- System.AggregateException: Error 2
 |   stack-trace ...
     |-- System.Exception: Error 3
     |   stack-trace ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions