/// <summary> /// Prints the contents of <paramref name="this"/> to the given <see cref="TextWriter"/>. /// </summary> /// <param name="this">The <see cref="Exception"/> to print.</param> /// <param name="writer">The <see cref="TextWriter"/> to write exception information to.</param> /// <exception cref="ArgumentNullException"> /// Thrown if either <paramref name="this"/> or <paramref name="writer"/> is <c>null</c>. /// </exception> public static void Print(this Exception @this, TextWriter writer) { @this.CheckParameterForNull("@this"); writer.CheckParameterForNull("writer"); writer.WriteLine("Type Name: {0}", @this.GetType().FullName); #if !SILVERLIGHT writer.WriteLine("\tSource: {0}", @this.Source); writer.WriteLine("\tTargetSite: {0}", ExceptionExtensions.FormatMethod(@this.TargetSite)); #endif writer.WriteLine("\tMessage: {0}", @this.Message); #if !SILVERLIGHT writer.WriteLine("\tHelpLink: {0}", @this.HelpLink); #endif @this.PrintCustomProperties(writer); @this.PrintStackTrace(writer); @this.PrintData(writer); if (@this.InnerException != null) { writer.WriteLine(); @this.InnerException.Print(writer); } }