static async UniTaskVoid ToCancellationTokenCore(UniTask task, CancellationTokenSource cts) { try { await task; } catch (Exception ex) { UniTaskScheduler.PublishUnobservedTaskException(ex); } cts.Cancel(); cts.Dispose(); }
void ReportUnhandledError() { if (hasUnhandledError) { try { if (error is OperationCanceledException oc) { UniTaskScheduler.PublishUnobservedTaskException(oc); } else if (error is ExceptionHolder e) { UniTaskScheduler.PublishUnobservedTaskException(e.GetException().SourceException); } } catch { } } }