internal static string GetExceptionDiagnosticInfo(Exception exception) { StringBuilder stringBuilder = new StringBuilder((exception.InnerException == null) ? 1000 : 2000); stringBuilder.Append(exception.Message); Exception ex = (exception.InnerException == null) ? exception : exception.InnerException; MapiPermanentException ex2 = ex as MapiPermanentException; if (ex2 != null) { stringBuilder.AppendFormat(" {0}", StorageExceptionHandler.GetDiagnosticInfo(ex2)); } else { MapiRetryableException ex3 = ex as MapiRetryableException; if (ex3 != null) { stringBuilder.AppendFormat(" {0}", StorageExceptionHandler.GetDiagnosticInfo(ex3)); } else { stringBuilder.AppendFormat(" {0}: {1}", ex.GetType().Name, ex.Message); } } return(stringBuilder.ToString()); }