/// <summary> /// /// </summary> /// <param name="testGroup"></param> /// <param name="test"></param> /// <param name="input"></param> /// <param name="methodName"></param> /// <param name="invokeError"></param> /// <param name="otherErrors"></param> public static void LogErrors(AdvancedTestGroup testGroup, CdsSubTest test, InputParams input, string methodName, UPnPInvokeException invokeError, IList otherErrors) { if (invokeError != null) { StringBuilder msg = new StringBuilder(); msg.Append("\r\n"); msg.AppendFormat("[{0}]({1}) <Invoke Error>. ", testGroup.GroupName, test.Name, LogImportance.Critical.ToString()); FieldInfo[] fi = input.GetType().GetFields(); msg.AppendFormat("Method={0}\r\n \tInput=(", methodName); for (int i = 0; i < fi.Length; i++) { msg.Append("\r\n\t\t"); object val = fi[i].GetValue(input); string valString = ""; if (val != null) { valString = val.ToString(); } if (i > 0) { msg.Append(", "); } msg.AppendFormat("[{0}={1}]", fi[i].Name, valString); } msg.Append("\r\n\t)."); msg.AppendFormat("\r\n\tInvokeErrorMessage=<{0}>.", PrintStackTraceRecursively(invokeError, "\t\t")); foreach (Exception e in otherErrors) { if (e != null) { msg.AppendFormat("\r\n\tAdditionalErrorInfo=<{0}>.", PrintStackTraceRecursively(e, "\t\t")); } } testGroup.AddEvent(LogImportance.Critical, test.Name, msg.ToString()); } }
/// <summary> /// /// </summary> /// <param name="testGroup"></param> /// <param name="test"></param> /// <param name="input"></param> /// <param name="methodName"></param> /// <param name="invokeError"></param> /// <param name="otherErrors"></param> public static void LogErrors(AdvancedTestGroup testGroup, CdsSubTest test, InputParams input, string methodName, UPnPInvokeException invokeError, IList otherErrors) { if (invokeError != null) { StringBuilder msg = new StringBuilder(); msg.Append("\r\n"); msg.AppendFormat("[{0}]({1}) <Invoke Error>. ", testGroup.GroupName, test.Name, LogImportance.Critical.ToString()); FieldInfo[] fi = input.GetType().GetFields(); msg.AppendFormat("Method={0}\r\n \tInput=(", methodName); for (int i=0; i < fi.Length; i++) { msg.Append("\r\n\t\t"); object val = fi[i].GetValue(input); string valString = ""; if (val != null) { valString = val.ToString(); } if (i > 0) { msg.Append(", "); } msg.AppendFormat("[{0}={1}]", fi[i].Name, valString); } msg.Append("\r\n\t)."); msg.AppendFormat("\r\n\tInvokeErrorMessage=<{0}>.", PrintStackTraceRecursively(invokeError, "\t\t")); foreach (Exception e in otherErrors) { if (e != null) { msg.AppendFormat("\r\n\tAdditionalErrorInfo=<{0}>.", PrintStackTraceRecursively(e, "\t\t")); } } testGroup.AddEvent(LogImportance.Critical, test.Name, msg.ToString()); } }