Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TaskExceptionHolder.cs
Go to the documentation of this file.
3
5
6internal sealed class TaskExceptionHolder
7{
8 private readonly Task m_task;
9
11
13
14 private volatile bool m_isHandled;
15
16 internal bool ContainsFaultList => m_faultExceptions != null;
17
19 {
20 m_task = task;
21 }
22
32
33 internal void Add(object exceptionObject, bool representsCancellation)
34 {
36 {
38 }
39 else
40 {
42 }
43 }
44
58
60 {
62 if (list == null)
63 {
65 }
67 {
69 }
71 {
72 list.Add(item);
73 }
74 else if (exceptionObject is IEnumerable<Exception> enumerable)
75 {
76 foreach (Exception item2 in enumerable)
77 {
79 }
80 }
81 else
82 {
84 {
86 }
87 list.AddRange(collection);
88 }
89 if (list.Count > 0)
90 {
92 }
93 }
94
95 private void MarkAsUnhandled()
96 {
97 if (m_isHandled)
98 {
100 m_isHandled = false;
101 }
102 }
103
105 {
106 if (!m_isHandled)
107 {
109 {
110 GC.SuppressFinalize(this);
111 }
112 m_isHandled = true;
113 }
114 }
115
117 {
120 if (includeThisException == null)
121 {
123 }
124 Exception[] array = new Exception[faultExceptions.Count + 1];
125 for (int i = 0; i < array.Length - 1; i++)
126 {
127 array[i] = faultExceptions[i].SourceException;
128 }
130 return new AggregateException(array);
131 }
132
139
144}
void Add(TKey key, TValue value)
static void SuppressFinalize(object obj)
Definition GC.cs:202
static void ReRegisterForFinalize(object obj)
Definition GC.cs:214
Definition GC.cs:8
static ExceptionDispatchInfo Capture(Exception source)
static string TaskExceptionHolder_UnhandledException
Definition SR.cs:1970
static string TaskExceptionHolder_UnknownExceptionType
Definition SR.cs:1972
Definition SR.cs:7
List< ExceptionDispatchInfo > GetExceptionDispatchInfos()
void AddFaultException(object exceptionObject)
AggregateException CreateExceptionObject(bool calledFromFinalizer, Exception includeThisException)
void MarkAsHandled(bool calledFromFinalizer)
ExceptionDispatchInfo GetCancellationExceptionDispatchInfo()
void SetCancellationException(object exceptionObject)
volatile List< ExceptionDispatchInfo > m_faultExceptions
void Add(object exceptionObject, bool representsCancellation)
static void PublishUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs ueea)