diff options
Diffstat (limited to 'mcs/class/corlib/System.Diagnostics/StackTrace.cs')
-rw-r--r-- | mcs/class/corlib/System.Diagnostics/StackTrace.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs index 3e775808fdc..721c38ef786 100644 --- a/mcs/class/corlib/System.Diagnostics/StackTrace.cs +++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs @@ -57,6 +57,7 @@ namespace System.Diagnostics { public const int METHODS_TO_SKIP = 0; private StackFrame[] frames; + readonly StackTrace[] captured_traces; private bool debug_info; public StackTrace () @@ -148,6 +149,8 @@ namespace System.Diagnostics { frames = l.ToArray (); } } + + captured_traces = e.captured_traces; } public StackTrace (StackFrame frame) @@ -189,7 +192,7 @@ namespace System.Diagnostics { return frames; } - internal bool AddFrames (StringBuilder sb, bool isException = false) + bool AddFrames (StringBuilder sb, bool isException = false) { bool printOffset; string debugInfo, indentation; @@ -306,6 +309,21 @@ namespace System.Diagnostics { public override string ToString () { StringBuilder sb = new StringBuilder (); + + // + // Add traces captured using ExceptionDispatchInfo + // + if (captured_traces != null) { + foreach (var t in captured_traces) { + if (!t.AddFrames (sb, true)) + continue; + + sb.Append (Environment.NewLine); + sb.Append ("--- End of stack trace from previous location where exception was thrown ---"); + sb.Append (Environment.NewLine); + } + } + AddFrames (sb); return sb.ToString (); } |