{"record":{"id":"44aa140ef5ab96f5","repo":"egametang/ET","slug":"e-lastoperation","errorCode":null,"errorMessage":"{e.LastOperation}","messagePattern":"\\{e\\.LastOperation\\}","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.core/Scripts/Core/Share/Network/TService.cs","lineNumber":282,"sourceCode":"\t\t\t\t\t{\n\t\t\t\t\t\tTChannel tChannel = this.Get(result.ChannelId);\n\t\t\t\t\t\tif (tChannel != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttChannel.OnRecvComplete(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase SocketAsyncOperation.Send:\n\t\t\t\t\t{\n\t\t\t\t\t\tTChannel tChannel = this.Get(result.ChannelId);\n\t\t\t\t\t\tif (tChannel != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttChannel.OnSendComplete(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new ArgumentOutOfRangeException($\"{e.LastOperation}\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}","sourceCodeStart":264,"sourceCodeEnd":287,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.core/Scripts/Core/Share/Network/TService.cs#L264-L287","documentation":"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.","triggerScenarios":"A SocketAsyncOperation not covered (Disconnect, DisconnectReuse, etc.) arriving from a completed args, or a future operation added to the code path.","commonSituations":"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.","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."],"exampleFix":"// before\ndefault: throw new ArgumentOutOfRangeException($\"{e.LastOperation}\");\n// after\ncase SocketAsyncOperation.Disconnect: /* handle */ break;\ndefault: Log.Error($\"unhandled socket op {e.LastOperation}\"); break;","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try { ProcessQueue(e); }\ncatch (ArgumentOutOfRangeException) { Log.Error($\"unhandled socket op {e.LastOperation}\"); }","preventionTips":["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."],"tags":["network","tcp","socket","csharp"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}