internal ExceptionInfo(Exception ex)
        {
            this.Type = ex.GetType().Name;
            this.Message = ex.Message;
            this.StackTrace = ex.StackTrace;

            this.Source = ex.Source;
            if (ex.InnerException != null)
            {
                this.InnerExceptionInfo = new ExceptionInfo(ex.InnerException);
            }
        }
        internal static ExceptionInfo ReadFromXMLReader(XmlReader reader)
        {
            ExceptionInfo res = new ExceptionInfo();
            try
            {
                res.ReadXml(reader);
            }
            catch (XmlException)
            {
                return null;
            }

            return res;
        }
        internal ExceptionInfo(Exception ex)
        {
            this.Type = ex.GetType().Name;
            this.Message = ex.Message;
            this.StackTrace = ex.StackTrace;
#if WINDOWS_RT
            this.HResult = ex.HResult;
#endif

            this.Source = ex.Source;
            if (ex.InnerException != null)
            {
                this.InnerExceptionInfo = new ExceptionInfo(ex.InnerException);
            }
        }
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement("ExceptionInfo");
            this.Type = CommonUtility.ReadElementAsString("Type", reader);
            this.Message = CommonUtility.ReadElementAsString("Message", reader);
            this.Source = CommonUtility.ReadElementAsString("Source", reader);
            this.StackTrace = CommonUtility.ReadElementAsString("StackTrace", reader);

            if (reader.IsStartElement() && reader.LocalName == "InnerExceptionInfo")
            {
                reader.ReadStartElement("InnerExceptionInfo");
                this.InnerExceptionInfo = ReadFromXMLReader(reader);
                reader.ReadEndElement();
            }

            // End ExceptionInfo
            reader.ReadEndElement();
        }
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement("ExceptionInfo");
            this.Type = CommonUtility.ReadElementAsString("Type", reader);

#if WINDOWS_RT || ASPNET_K || PORTABLE
            this.HResult = int.Parse(CommonUtility.ReadElementAsString("HResult", reader));
#endif
            this.Message = CommonUtility.ReadElementAsString("Message", reader);
            this.Source = CommonUtility.ReadElementAsString("Source", reader);
            this.StackTrace = CommonUtility.ReadElementAsString("StackTrace", reader);

            if (reader.IsStartElement() && reader.LocalName == "InnerExceptionInfo")
            {
                reader.ReadStartElement("InnerExceptionInfo");
                this.InnerExceptionInfo = ReadFromXMLReader(reader);
                reader.ReadEndElement();
            }

            // End ExceptionInfo
            reader.ReadEndElement();
        }
        internal ExceptionInfo(Exception ex)
        {
            this.Type = ex.GetType().Name;
            this.Message = ex.Message;
            this.StackTrace = ex.StackTrace;
#if RTMD
            this.HResult = ex.HResult;
#endif

#if COMMON
#else
            this.Source = ex.Source;
#endif
            if (ex.InnerException != null)
            {
                this.InnerExceptionInfo = new ExceptionInfo(ex.InnerException);
            }
        }
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement("ExceptionInfo");
            this.Type = General.ReadElementAsString("Type", reader);

#if RTMD
            this.HResult = int.Parse(General.ReadElementAsString("HResult", reader));
#endif
            this.Message = General.ReadElementAsString("Message", reader);
#if COMMON
#else
            this.Source = General.ReadElementAsString("Source", reader);
#endif
            this.StackTrace = General.ReadElementAsString("StackTrace", reader);

            if (reader.IsStartElement() && reader.LocalName == "InnerExceptionInfo")
            {
                reader.ReadStartElement("InnerExceptionInfo");
                this.InnerExceptionInfo = ReadFromXMLReader(reader);
                reader.ReadEndElement();
            }

            // End ExceptionInfo
            reader.ReadEndElement();
        }