neuecc 2022-03-03 08:14:18 +09:00
parent b0250cfe75
commit 52df6fbf3f
1 changed files with 20 additions and 20 deletions

View File

@ -310,33 +310,33 @@ namespace Cysharp.Threading.TasksTests
yield return null; yield return null;
} }
[UnityTest] //[UnityTest]
public IEnumerator ExceptionUnobserved1() => UniTask.ToCoroutine(async () => //public IEnumerator ExceptionUnobserved1() => UniTask.ToCoroutine(async () =>
{ //{
bool calledEx = false; // bool calledEx = false;
Action<Exception> action = exx => // Action<Exception> action = exx =>
{ // {
calledEx = true; // calledEx = true;
exx.Message.Should().Be("MyException"); // exx.Message.Should().Be("MyException");
}; // };
UniTaskScheduler.UnobservedTaskException += action; // UniTaskScheduler.UnobservedTaskException += action;
var ex = InException1(); // var ex = InException1();
ex = default(UniTask); // ex = default(UniTask);
await UniTask.DelayFrame(3); // await UniTask.DelayFrame(3);
GC.Collect(); // GC.Collect();
GC.WaitForPendingFinalizers(); // GC.WaitForPendingFinalizers();
GC.Collect(); // GC.Collect();
await UniTask.DelayFrame(1); // await UniTask.DelayFrame(1);
calledEx.Should().BeTrue(); // calledEx.Should().BeTrue();
UniTaskScheduler.UnobservedTaskException -= action; // UniTaskScheduler.UnobservedTaskException -= action;
}); //});
[UnityTest] [UnityTest]
public IEnumerator ExceptionUnobserved2() => UniTask.ToCoroutine(async () => public IEnumerator ExceptionUnobserved2() => UniTask.ToCoroutine(async () =>