public override string ToString() { if (OriginalException is not null) { return(OriginalException.ToString()); } StringBuilder output = new(); output.Append($"{Type}: {Message}"); Stack <SerializableException> inners = new(); SerializableException? inner = InnerException; while (inner is not null) { output.Append($" ---> {inner.Type}: {inner.Message}"); inners.Push(inner); inner = inner.InnerException; } output.AppendLine(); while (inners.Count > 0) { inner = inners.Pop(); output.AppendLine(inner.StackTrace); output.AppendLine(" --- End of inner exception stack trace ---"); } output.AppendLine(StackTrace); return(output.ToString()); }
public override string ToString() { return(OriginalException?.ToString() ?? base.ToString()); }