How to reproduce:
1. Open the attached "IN-149437_AwaitableBug.zip" project
2. Open the "SampleScene"
3. Enter Play mode
4. Observe the Console
Actual result: An "OperationCanceledException" error is thrown in the Console
Expected result: No errors are thrown in the Console
Reproducible with: 6000.4.0a2 (417aa67423b3), 6000.5.10f1, 6000.6.0b9, 6000.7.0a5
Not reproducible with: 6000.0.82f1, 6000.3.23f1, 6000.4.0a1
Reproducible on: Windows 11
Not reproducible on: No other environments tested
Note: Full error message:
”OperationCanceledException: Running async code belongs to the previous CodeLoaded scope and must be cancelled before Code Reload
Unity.Scripting.LifecycleManagement.CodeLoadedScope.CancelIfNotInCorrectGeneration () (at <84b11baffc7f430aa1bea85fe187e5ce>:0)
UnityEngine.Awaitable.PropagateExceptionAndRelease () (at <2f52b751ded44e96b74c2c8a24c6c65b>:0)
AwaitableTest.Test () (at Assets/AwaitableTest.cs:19)
UnityEngine.Debug:LogException(Exception)
<Test>d__1:MoveNext() (at Assets/AwaitableTest.cs:34)
UnityEngine.Awaitable:RaiseManagedCompletion()
<SubTask>d__2:MoveNext() (at Assets/AwaitableTest.cs:41)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()”