示例#1
0
        /// <summary>
        /// Parses the given XML-representation and creates an <see cref="ErrorReport"/> off of it.
        /// </summary>
        /// <param name="xml">The XML-representation to convert.</param>
        /// <returns></returns>
        public static ErrorReport Deserialize(string xml)
        {
            XDocument doc  = XDocument.Parse(xml);
            XElement  root = doc.Root;

            ErrorReport report = new ErrorReport();

            report.Timestamp           = DateTime.Parse(root.Element("Timestamp").Value).ToUniversalTime();
            report.SourceComponentName = root.Element("ComponentName").Value;
            report.IsTerminating       = bool.Parse(root.Element("IsTerminating").Value);
            report.Exception           = ExceptionDetail.Deserialize(root.Element("ExceptionDetail"));

            return(report);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionDetail"/> class.
        /// </summary>
        /// <param name="exception">The exception object. Must not be null.</param>
        internal ExceptionDetail(Exception exception)
            : this()
        {
            Assertions.AssertNotNull(exception, "exception");

            this.Type       = exception.GetType().AssemblyQualifiedName;
            this.Message    = exception.Message;
            this.Source     = exception.Source;
            this.StackTrace = exception.StackTrace;

            if (exception.InnerException != null)
            {
                this.InnerException = new ExceptionDetail(exception.InnerException);
            }
        }
示例#3
0
        /// <summary>
        /// Parses the given XML-representation and creates an <see cref="ExceptionDetail"/> off of it.
        /// </summary>
        /// <param name="xml">The XML-representation to convert.</param>
        /// <returns></returns>
        internal static ExceptionDetail Deserialize(XElement xml)
        {
            ExceptionDetail detail = new ExceptionDetail();

            detail.Type       = xml.Attribute("Type").Value;
            detail.Message    = xml.Element("Message").Value;
            detail.Source     = xml.Element("Source").Value;
            detail.StackTrace = xml.Element("StackTrace").Value;

            XElement innerException = xml.Element("ExceptionDetail");

            if (innerException != null)
            {
                detail.InnerException = Deserialize(innerException);
            }

            return(detail);
        }
        /// <summary>
        /// Parses the given XML-representation and creates an <see cref="ExceptionDetail"/> off of it.
        /// </summary>
        /// <param name="xml">The XML-representation to convert.</param>
        /// <returns></returns>
        internal static ExceptionDetail Deserialize(XElement xml)
        {
            ExceptionDetail detail = new ExceptionDetail();
            detail.Type = xml.Attribute("Type").Value;
            detail.Message = xml.Element("Message").Value;
            detail.Source = xml.Element("Source").Value;
            detail.StackTrace = xml.Element("StackTrace").Value;

            XElement innerException = xml.Element("ExceptionDetail");
            if (innerException != null)
            {
                detail.InnerException = Deserialize(innerException);
            }

            return detail;
        }