"Already continuation registered, can not await twice" - how to debug?
See original GitHub issueHello! Apologies if this is a basic question - I’ve been struggling with this for a few days. I’m getting the exception on the following await,
System.InvalidOperationException: Already continuation registered, can not await twice or get Status after await.
var handle = Addressables.LoadAssetAsync<UnityEngine.Object>(args.RefCounter.Resource);
await handle;
As far as I can see there’s no reason for this error to be thrown? I don’t await the handle twice, so I am unsure how to properly debug this issue? Could it be caused elsewhere in the code since the tasks are pooled? The error isn’t thrown on the first time this code runs - it’s after many loads and under specific circumstances. Any help on how to best track this down would be appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
what happens if I await a task that is already running or ran?
If the task isn't complete, it will call UnsafeOnCompleted which will register the continuation. If it is complete, it breaks the switch and ......
Read more >Why do I need to await twice for one request? : r/node
So I am connecting to PSQL database and I am just curious why do I need to await twice, here is the code:...
Read more >UniTask v2 — Zero Allocation async/await for Unity, with ...
As a limitation, all UniTask objects cannot await twice, as they automatically return to the pool when the await completes.
Read more >How to use continuations to convert completion handlers ...
Your continuation must be resumed exactly once. Not zero times, and not twice or more times – exactly once. If you call the...
Read more >How Async/Await Really Works in C# - .NET Blog
Employ a mechanism that allows the caller rather than the callback to do the continuation work if the operation completes synchronously. That ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve released
2.1.1, it includes fix about IEnumerator.ToUniTask.when Coroutine(Enumerator) returns immediately, will break pool. Maybe it is not same as first reported, but actualy it is crtical bug.