When calling ToCancellationToken on a completed task, an exception occurred
UniTask.CompletedTask.ToCancellationToken();
// System.ObjectDisposedException: The CancellationTokenSource has been disposed.
The source code of ToCancellationToken is
var cts = new CancellationTokenSource();
Core(task, cts).Forget();
return cts.Token;
If the task is completed, cts will be disposed synchronously in Core() and then accessing cts.Token causes ObjectDisposeException
Is this a bug or by design?
When calling
ToCancellationTokenon a completed task, an exception occurredThe source code of
ToCancellationTokenisIf the task is completed,
ctswill be disposed synchronously inCore()and then accessingcts.TokencausesObjectDisposeExceptionIs this a bug or by design?