egametang/ET · error · NotSupportedException
ETTask does not allow call GetResult directly when task not
Error message
ETTask does not allow call GetResult directly when task not completed. Please use 'await'.
What it means
Thrown by ETTask.GetResult() when the task's state is neither Succeeded nor Faulted — i.e. still Pending. The ET coroutine framework requires callers to await completion before reading the result; reading it early is undefined and explicitly rejected with NotSupportedException. This usually indicates calling GetResult manually instead of awaiting.
Source
Thrown at Packages/cn.etetet.core/Scripts/Core/Share/ETTask/ETTask.cs:203
this.UnsafeOnCompleted(action);
}
[DebuggerHidden]
public void GetResult()
{
switch (this.state)
{
case AwaiterStatus.Succeeded:
this.Recycle();
break;
case AwaiterStatus.Faulted:
ExceptionDispatchInfo c = this.callback as ExceptionDispatchInfo;
this.callback = null;
this.Recycle();
c?.Throw();
break;
default:
throw new NotSupportedException("ETTask does not allow call GetResult directly when task not completed. Please use 'await'.");
}
}
[DebuggerHidden]
public void SetResult()
{
if (this.state != AwaiterStatus.Pending)
{
throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
}
this.state = AwaiterStatus.Succeeded;
Action c = this.callback as Action;
this.callback = null;
c?.Invoke();
}
View on GitHub (pinned to 5cab01f7a8)
Solutions
- Always await the ETTask: await task; before inspecting its result.
- If you must poll, check the task's completion state (IsCompleted) before GetResult.
- Refactor manual GetResult call sites into proper async/await.
Example fix
// before task.GetResult(); // throws if not completed // after await task; // safe: blocks coroutine until completion
Defensive patterns
Strategy: validation
Validate before calling
// Only read result after completion. if (!task.IsCompleted) await task; task.GetResult(); // now safe
Try / catch
try { task.GetResult(); } catch (NotSupportedException ex) when (ex.Message.Contains("not completed")) { await task; } Prevention
- Always await ETTask instead of calling GetResult manually.
- Check IsCompleted before any manual result probe.
- Refactor synchronous-looking GetResult call sites into async/await.
When it happens
Trigger: Invoking task.GetResult() before the coroutine has finished; manually driving an ETTask without awaiting; polling a task in a busy loop and reading result too early; awaiter misuse that skips awaiting.
Common situations: Replacing await with a manual GetAwaiter().GetResult() call on an incomplete task; synchronous-looking code over async ET coroutines; debugging code that probes result eagerly; forgetting that ETTask completion is fiber-driven.
Related errors
- TaskT_TransitionToFinal_AlreadyCompleted
- add cancel token is null
- service discovery agent disposed
- btenv not found key: {key} {typeof(T).FullName}
- 不能把{value.GetType()}转换为{typeof (T)}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/169106d776d63b4c.
Report an issue: GitHub.