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

  1. Add the missing case (e.g. Disconnect) to the switch and handle it gracefully.
  2. Log and continue on unknown ops instead of throwing to keep the loop alive.
  3. 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

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


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/44aa140ef5ab96f5. Report an issue: GitHub.