{"record":{"id":"2bc853c7d792e3e5","repo":"dotnet/runtime","slug":"failed-on-mono-wasm-get-dbg-command-info","errorCode":null,"errorMessage":"Failed on mono_wasm_get_dbg_command_info","messagePattern":"Failed on mono_wasm_get_dbg_command_info","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/debug.ts","lineNumber":109,"sourceCode":"export function mono_wasm_send_dbg_command (id: number, command_set: number, command: number, command_parameters: string): CommandResponseResult {\n    forceThreadMemoryViewRefresh();\n\n    mono_wasm_malloc_and_set_debug_buffer(command_parameters);\n    cwraps.mono_wasm_send_dbg_command(id, command_set, command, _debugger_buffer, command_parameters.length);\n\n    const { res_ok, res } = commands_received.remove(id);\n\n    if (!res_ok)\n        throw new Error(\"Failed on mono_wasm_send_dbg_command\");\n    return res;\n\n}\n\nexport function mono_wasm_get_dbg_command_info (): CommandResponseResult {\n    const { res_ok, res } = commands_received.remove(0);\n\n    if (!res_ok)\n        throw new Error(\"Failed on mono_wasm_get_dbg_command_info\");\n    return res;\n}\n\nexport function mono_wasm_debugger_resume (): void {\n    forceThreadMemoryViewRefresh();\n}\n\nexport function mono_wasm_detach_debugger (): void {\n    forceThreadMemoryViewRefresh();\n    cwraps.mono_wasm_set_is_debugger_attached(false);\n}\n\nexport function mono_wasm_change_debugger_log_level (level: number): void {\n    forceThreadMemoryViewRefresh();\n    cwraps.mono_wasm_change_debugger_log_level(level);\n}\n\n/**","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/debug.ts#L91-L127","documentation":"Thrown by mono_wasm_get_dbg_command_info() in debug.ts. Unlike the send functions, this reads the command id 0 entry from the commands_received map (the special handshake/info slot populated by native). A res_ok=false here means the native debugger agent failed to produce the initial command info, i.e. the debugger protocol handshake or the very first info query failed.","triggerScenarios":"Calling mono_wasm_get_dbg_command_info() before the native debugger agent has pushed the id=0 response, or when the native agent errored during its initial command. Racing the info query with runtime teardown or before the debugger module finished initializing.","commonSituations":"Attaching DevTools/VS Code debugger before the WASM runtime debugger agent is fully ready. Debugging a build where the debugger native code was stripped or a debugger-related env var disabled the agent. A runtime build that did not include debugger support.","solutions":["Wait until the runtime/debugger agent signals ready before issuing info queries (mono_wasm_runtime_ready / waitForDebugger flow).","Build the app with debugger support enabled (debug configuration, not a release build that strips the debugger).","Reload so the native agent re-initializes cleanly.","Confirm DOTNET_SYSTEM_NET_* and debugger-related build properties are not disabling the diagnostic/debug agent."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"let info;\ntry { info = mono_wasm_get_dbg_command_info(); }\ncatch (e) { /* debugger agent not ready/errored; wait and retry or report */ throw e; }","preventionTips":["Build with debugger support enabled.","Wait for runtime ready before issuing debugger info queries.","Reload to reinitialize a wedged native agent."],"tags":["debugger","native-interop","initialization","handshake"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}