Quick answer: Godot 4 C# Task waiting on a main-thread CallDeferred deadlocks? Thread pool exhausted by sync waiters - use async patterns end-to-end.

Task awaits a CallDeferred from a thread pool task; main thread waits on task; deadlock.

Avoid Wait()

Use await throughout. Task.Wait blocks the thread pool; deadlock common.

Or use ConfigureAwait(false)

If you must Wait, avoid deadlock by configuring not to capture context.

Audit Task.Result usage

Task.Result waits synchronously. Same hazard as Wait. Replace with await.

“Sync waits on async are deadlock vectors. Stay async or stay sync; don't mix.”

For Godot C#, async-all-the-way is the safer pattern. Sync waits look simpler and produce production deadlocks.

Related reading