public static XmlException FromException(Exception exception) { if (exception == null) { throw new ArgumentNullException("exception"); } if (exception is System.Reflection.TargetInvocationException) { return(FromException(exception.InnerException)); } XmlException xex = new XmlException(); xex.ExceptionType = exception.GetType().FullName; xex.Message = UnitSerializer.XmlSerializerEscapeWorkAround(exception.Message); xex.StackTrace = exception.StackTrace; xex.Source = exception.Source; if (exception.InnerException != null) { xex.InnerException = FromException(exception.InnerException); } foreach (System.Collections.DictionaryEntry de in exception.Data) { xex.Properties.Add(de); } return(xex); }
public void Update(TestMonitor monitor) { this.consoleError = UnitSerializer.XmlSerializerEscapeWorkAround(monitor.Console.Error); this.consoleOut = UnitSerializer.XmlSerializerEscapeWorkAround(monitor.Console.Out); this.startTime = monitor.Timer.StartTime.ToString("u"); this.endTime = monitor.Timer.EndTime.ToString("u"); this.duration = monitor.Timer.Duration; this.log = monitor.GetLog(); }