Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DisposePendingDisposablesOnExceptionAsync()

async ValueTask System.Text.Json.WriteStack.DisposePendingDisposablesOnExceptionAsync ( )
inline

Definition at line 188 of file WriteStack.cs.

189 {
190 Exception exception2 = null;
192 int stackSize = Math.Max(_count, _continuationCount);
193 for (int i = 0; i < stackSize - 1; i++)
194 {
195 exception2 = await DisposeFrame(_stack[i].CollectionEnumerator, _stack[i].AsyncDisposable, exception2).ConfigureAwait(continueOnCapturedContext: false);
196 }
197 if (exception2 != null)
198 {
200 }
202 {
203 try
204 {
205 if (collectionEnumerator is IDisposable disposable)
206 {
207 disposable.Dispose();
208 }
209 else if (asyncDisposable != null)
210 {
211 await asyncDisposable.DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
212 }
213 }
214 catch (Exception ex)
215 {
216 exception = ex;
217 }
218 return exception;
219 }
220 }
static ExceptionDispatchInfo Capture(Exception source)
WriteStackFrame Current
Definition WriteStack.cs:15
WriteStackFrame[] _stack
Definition WriteStack.cs:17

References System.Text.Json.WriteStack._continuationCount, System.Text.Json.WriteStack._count, System.Text.Json.WriteStack._stack, System.Text.Json.WriteStackFrame.AsyncDisposable, System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(), System.Text.Json.WriteStackFrame.CollectionEnumerator, System.Text.Json.WriteStack.Current, System.Text.Json.Dictionary, System.exception, and System.Math.Max().