Example #1
0
        internal GeneralInfo(SerializableException serializableException)
        {
            HostApplication = AssemblyTools.EntryAssembly.GetLoadedModules()[0].Name;

            var version = FileVersionInfo.GetVersionInfo(AssemblyTools.EntryAssembly.Location).ProductVersion;
            HostApplicationVersion = version;
            NCrashVersion = version;

            NCrashVersion = FileVersionInfo.GetVersionInfo(Assembly.GetCallingAssembly().Location).ProductVersion;

            ClrVersion = Environment.Version.ToString();

            DateTime = System.DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);

            if (serializableException != null)
            {
                ExceptionType = serializableException.Type;

                if (!string.IsNullOrEmpty(serializableException.TargetSite))
                {
                    TargetSite = serializableException.TargetSite;
                }
                else if (serializableException.InnerException != null && !string.IsNullOrEmpty(serializableException.InnerException.TargetSite))
                {
                    TargetSite = serializableException.InnerException.TargetSite;
                }

                ExceptionMessage = serializableException.Message;
            }
        }
        internal GeneralInfo(SerializableException serializableException)
        {
            HostApplication = AssemblyTools.EntryAssembly.GetLoadedModules()[0].Name;

            var version = FileVersionInfo.GetVersionInfo(AssemblyTools.EntryAssembly.Location).ProductVersion;

            HostApplicationVersion = version;
            NCrashVersion          = version;

            NCrashVersion = FileVersionInfo.GetVersionInfo(Assembly.GetCallingAssembly().Location).ProductVersion;

            ClrVersion = Environment.Version.ToString();

            DateTime = System.DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);

            if (serializableException != null)
            {
                ExceptionType = serializableException.Type;

                if (!string.IsNullOrEmpty(serializableException.TargetSite))
                {
                    TargetSite = serializableException.TargetSite;
                }
                else if (serializableException.InnerException != null && !string.IsNullOrEmpty(serializableException.InnerException.TargetSite))
                {
                    TargetSite = serializableException.InnerException.TargetSite;
                }

                ExceptionMessage = serializableException.Message;
            }
        }
Example #3
0
        internal void Initialize(SerializableException exception)
        {
            _exceptionDetailsList.Add(exceptionTreeView.Nodes.Add(exception.Type), exception);

            if (exception.InnerException != null)
            {
                FillInnerExceptionTree(exception.InnerException, exceptionTreeView.Nodes[0]);
            }

            if (exception.InnerExceptions != null)
            {
                foreach (var innerException in exception.InnerExceptions)
                {
                    FillInnerExceptionTree(innerException, exceptionTreeView.Nodes[0]);
                }
            }

            exceptionTreeView.ExpandAll();
            DisplayExceptionDetails(exceptionTreeView.Nodes[0]);
        }
Example #4
0
        private void FillInnerExceptionTree(SerializableException innerException, TreeNode innerNode)
        {
            _exceptionDetailsList.Add(innerNode.Nodes.Add(innerException.Type), innerException);

            if (innerException.InnerException != null)
            {
                FillInnerExceptionTree(innerException.InnerException, innerNode.Nodes[0]);
            }
        }
Example #5
0
 internal Report(SerializableException serializableException)
 {
     Exception = serializableException;
     GeneralInfo = new GeneralInfo(serializableException);
 }
Example #6
0
 internal Report(SerializableException serializableException)
 {
     Exception   = serializableException;
     GeneralInfo = new GeneralInfo(serializableException);
 }
Example #7
0
        public SerializableException(Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException();
            }

            Type = exception.GetType().ToString();

            if (exception.Data.Count != 0)
            {
                foreach (DictionaryEntry entry in exception.Data)
                {
                    if (entry.Value != null)
                    {
                        // Assign 'Data' property only if there is at least one entry with non-null value
                        if (Data == null)
                        {
                            Data = new SerializableDictionary <object, object>();
                        }

                        Data.Add(entry.Key, entry.Value);
                    }
                }
            }

            if (exception.HelpLink != null)
            {
                HelpLink = exception.HelpLink;
            }

            if (exception.InnerException != null)
            {
                InnerException = new SerializableException(exception.InnerException);
            }

            var aggregateException = exception as AggregateException;

            if (aggregateException != null)
            {
                InnerExceptions = new List <SerializableException>();

                foreach (var innerException in aggregateException.InnerExceptions)
                {
                    InnerExceptions.Add(new SerializableException(innerException));
                }

                if (InnerExceptions.Count > 1)
                {
                    // remove first in queue
                    InnerExceptions.RemoveAt(0);
                }
            }

            Message = exception.Message != string.Empty ? exception.Message : string.Empty;

            if (exception.Source != null)
            {
                Source = exception.Source;
            }

            if (exception.StackTrace != null)
            {
                StackTrace = exception.StackTrace;
            }

            if (exception.TargetSite != null)
            {
                TargetSite = exception.TargetSite + " @ " + exception.TargetSite.DeclaringType;
            }

            ExtendedInformation = GetExtendedInformation(exception);
        }
Example #8
0
        public SerializableException(Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException();
            }

            Type = exception.GetType().ToString();

            if (exception.Data.Count != 0)
            {
                foreach (DictionaryEntry entry in exception.Data)
                {
                    if (entry.Value != null)
                    {
                        // Assign 'Data' property only if there is at least one entry with non-null value
                        if (Data == null)
                        {
                            Data = new SerializableDictionary<object, object>();
                        }

                        Data.Add(entry.Key, entry.Value);
                    }
                }
            }

            if (exception.HelpLink != null)
            {
                HelpLink = exception.HelpLink;
            }

            if (exception.InnerException != null)
            {
                InnerException = new SerializableException(exception.InnerException);
            }

            var aggregateException = exception as AggregateException;
            if (aggregateException != null)
            {
                InnerExceptions = new List<SerializableException>();

                foreach (var innerException in aggregateException.InnerExceptions)
                {
                    InnerExceptions.Add(new SerializableException(innerException));
                }

                if (InnerExceptions.Count > 1)
                {
                    // remove first in queue
                    InnerExceptions.RemoveAt(0);
                }
            }

            Message = exception.Message != string.Empty ? exception.Message : string.Empty;

            if (exception.Source != null)
            {
                Source = exception.Source;
            }

            if (exception.StackTrace != null)
            {
                StackTrace = exception.StackTrace;
            }

            if (exception.TargetSite != null)
            {
                TargetSite = exception.TargetSite + " @ " + exception.TargetSite.DeclaringType;
            }

            ExtendedInformation = GetExtendedInformation(exception);
        }