Suppress cancelled task exception from bubbling

This commit is contained in:
Soreepeong 2024-02-22 18:31:04 +09:00
parent 2c013f39ca
commit e12563d20f

View file

@ -90,6 +90,7 @@ internal class TextureLoadThrottler : IServiceType
if (work.CancellationToken.IsCancellationRequested) if (work.CancellationToken.IsCancellationRequested)
{ {
work.TaskCompletionSource.SetCanceled(work.CancellationToken); work.TaskCompletionSource.SetCanceled(work.CancellationToken);
_ = work.TaskCompletionSource.Task.Exception;
this.RelocatePendingWorkItemToEndAndEraseUnsafe(i--); this.RelocatePendingWorkItemToEndAndEraseUnsafe(i--);
continue; continue;
} }
@ -117,6 +118,7 @@ internal class TextureLoadThrottler : IServiceType
catch (Exception e) catch (Exception e)
{ {
minWork.TaskCompletionSource.SetException(e); minWork.TaskCompletionSource.SetException(e);
_ = minWork.TaskCompletionSource.Task.Exception;
} }
lock (this.workListLock) lock (this.workListLock)