/// <summary> /// Called to inform the viewer of an exception state. /// </summary> /// <param name="Timestamp">Timestamp of event.</param> /// <param name="Exception">Exception.</param> public virtual void Exception(DateTime Timestamp, Exception Exception) { LinkedList <Exception> Inner = null; while (!(Exception is null)) { if (Exception is AggregateException AggregateException) { if (Inner is null) { Inner = new LinkedList <Exception>(); } foreach (Exception ex in AggregateException.InnerExceptions) { Inner.AddLast(ex); } } else if (!(Exception.InnerException is null)) { if (Inner is null) { Inner = new LinkedList <Exception>(); } Inner.AddLast(Exception.InnerException); } this.Exception(Timestamp, Exception.Message + "\r\n\r\n" + Log.CleanStackTrace(Exception.StackTrace)); if (Inner is null) { Exception = null; } else { Exception = Inner.First.Value; Inner.RemoveFirst(); } } }