Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Already continuation registered, can not await twice" - how to debug?

See original GitHub issue

Hello! 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:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

neuecccommented, Jan 20, 2021

I’ve released 2.1.1, it includes fix about IEnumerator.ToUniTask.

neuecccommented, Jan 20, 2021

when Coroutine(Enumerator) returns immediately, will break pool. Maybe it is not same as first reported, but actualy it is crtical bug.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found