egametang/ET · error · ArgumentOutOfRangeException
{e.LastOperation}
Error message
{e.LastOperation} What it means
TService's main loop processes queued SocketAsyncEventArgs by LastOperation and throws ArgumentOutOfRangeException for any op other than Accept/Receive/Send. This guards the dispatch switch against an unhandled operation type, i.e. an enum value the code wasn't written for.
Source
Thrown at Packages/cn.etetet.core/Scripts/Core/Share/Network/TService.cs:282
{
TChannel tChannel = this.Get(result.ChannelId);
if (tChannel != null)
{
tChannel.OnRecvComplete(e);
}
break;
}
case SocketAsyncOperation.Send:
{
TChannel tChannel = this.Get(result.ChannelId);
if (tChannel != null)
{
tChannel.OnSendComplete(e);
}
break;
}
default:
throw new ArgumentOutOfRangeException($"{e.LastOperation}");
}
}
}
}
}View on GitHub (pinned to 5cab01f7a8)
Solutions
- Add the missing case (e.g. Disconnect) to the switch and handle it gracefully.
- Log and continue on unknown ops instead of throwing to keep the loop alive.
- Confirm the operation types your channels actually emit and cover them all.
Example fix
// before
default: throw new ArgumentOutOfRangeException($"{e.LastOperation}");
// after
case SocketAsyncOperation.Disconnect: /* handle */ break;
default: Log.Error($"unhandled socket op {e.LastOperation}"); break; Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try { ProcessQueue(e); }
catch (ArgumentOutOfRangeException) { Log.Error($"unhandled socket op {e.LastOperation}"); } Prevention
- Cover every SocketAsyncOperation your channels emit.
- Default-case to log-and-continue to protect the main loop.
- Update the switch when introducing new socket ops.
When it happens
Trigger: A SocketAsyncOperation not covered (Disconnect, DisconnectReuse, etc.) arriving from a completed args, or a future operation added to the code path.
Common situations: A socket op such as Disconnect being enqueued due to a connection reset, or a regression that wires a new op type without updating the switch.
Related errors
- socket set buffer error: {this.sendBuffer.First.Length}, {th
- bind error: {ipEndPoint}
- socket error: {e.LastOperation}
- bind error: {ipEndPoint}
- recv packet size error, 可能是外网探测端口: {this.packetSize}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/44aa140ef5ab96f5.
Report an issue: GitHub.