2 using System.Collections.Generic;
8 public static class ExceptionExtensions
10 public static List<string> GetNestedMessages(
this Exception E)
12 List<string> L =
new List<string>();
14 if (E.InnerException != null)
16 L.AddRange(GetNestedMessages(E.InnerException));
21 public static string GetFullExceptionDetails(
this Exception E)
23 StringBuilder SB =
new StringBuilder();
26 SB.AppendLine(
"Message: {0} --> {1}".Build(E.GetType().Name, E.Message));
28 SB.AppendLine(
"Thread: {0}".Build(
System.Threading.Thread.CurrentThread.Name));
29 SB.AppendLine(
"Source: {0}".Build(E.Source));
32 foreach (
string S
in E.StackTrace.Split(
new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
34 SB.AppendLine(
"Stacktrace: {0}".Build(S));
37 if (E.TargetSite != null)
39 SB.AppendLine(
"Targetsite: {0}".Build(E.TargetSite.ToString()));
45 StackTrace ST =
new StackTrace(E,
true);
47 StackFrame
Frame = ST.GetFrame(0);
49 int Line = Frame.GetFileLineNumber();
50 string ExceptionFilename = Frame.GetFileName();
52 SB.AppendLine(
"Location: LineNr {0} in {1]".Build(Line, ExceptionFilename));
60 while (EInner.InnerException != null)
62 EInner = EInner.InnerException;
63 SB.AppendLine(
"InnerException {0}: {1} --> {2}".Build(Level, EInner.GetType().Name, EInner.Message));
Animation steps though frames of the source image (this mainly for animated gifs).