/// <summary> Returs formated stacktrace for the exception </summary> /// <exception cref="GetValueException"> Getting the stacktrace involves property /// evaluation so GetValueException can be thrown in some cicumstances. </exception> public string GetStackTrace(string endOfInnerExceptionFormat) { StringBuilder sb = new StringBuilder(); if (this.InnerException != null) { sb.Append(this.InnerException.GetStackTrace(endOfInnerExceptionFormat)); sb.Append(" "); sb.Append(endOfInnerExceptionFormat); sb.AppendLine(); } // Note that evaluation is not possible after a stackoverflow exception Value stackTrace = exception.GetMemberValue("StackTrace"); if (!stackTrace.IsNull) { sb.Append(stackTrace.AsString()); sb.AppendLine(); } return(sb.ToString()); }