{"record":{"id":"e7a7388fe6a53cf2","repo":"dotnet/runtime","slug":"jsobject-proxy-is-not-supported-for-jstype-va","errorCode":null,"errorMessage":"JSObject proxy is not supported for ${jsType} ${value}","messagePattern":"JSObject proxy is not supported for (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/marshal-to-cs.ts","lineNumber":401,"sourceCode":"                || value instanceof Int8Array\n                || value instanceof Uint8ClampedArray\n                || value instanceof Uint16Array\n                || value instanceof Uint32Array\n            ) {\n                throw new Error(\"NotImplementedException: TypedArray\");\n            } else if (isThenable(value)) {\n                marshalTaskToCs(arg, value);\n            } else if (value instanceof Span) {\n                throw new Error(\"NotImplementedException: Span\");\n            } else if (jsType == \"object\") {\n                const jsHandle = getJsHandleFromJSObject(value);\n                setArgType(arg, MarshalerType.JSObject);\n                if (BuildConfiguration === \"Debug\" && Object.isExtensible(value)) {\n                    value[proxyDebugSymbol] = `JS Object with JSHandle ${jsHandle}`;\n                }\n                setJsHandle(arg, jsHandle);\n            } else {\n                throw new Error(`JSObject proxy is not supported for ${jsType} ${value}`);\n            }\n        } else {\n            assertNotDisposed(value);\n            if (value instanceof ArraySegment) {\n                throw new Error(\"NotImplementedException: ArraySegment. \" + jsinteropDoc);\n            } else if (value instanceof ManagedError) {\n                setArgType(arg, MarshalerType.Exception);\n                setGcHandle(arg, gcHandle);\n            } else if (value instanceof ManagedObject) {\n                setArgType(arg, MarshalerType.Object);\n                setGcHandle(arg, gcHandle);\n            } else {\n                throw new Error(\"NotImplementedException \" + jsType + \". \" + jsinteropDoc);\n            }\n        }\n    }\n}\n","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/marshal-to-cs.ts#L383-L419","documentation":"The final fallback in marshalCsObjectToCs: the JS value has no GCHandle, typeof is not string/number/boolean/bigint/object-handled, and is not an array/date/error/thenable/span. The current case in practice is typeof === \"function\": a raw JS function passed where a marshaled object was expected.","triggerScenarios":"Passing a JS function reference to a C# method whose parameter is typed `object` rather than as a delegate/function handle. Also passing exotic host objects whose typeof returns an unsupported category.","commonSituations":"Trying to send a callback function to C# via an object-typed parameter instead of using a delegate/Action marshaler; passing a Proxy or class constructor where a data object was expected.","solutions":["If you intend to pass a callable, declare the C# parameter as a delegate (Action/Func) with the appropriate [JSMarshalAsAttribute<JSType.Function>] so the function marshaler is used.","Otherwise, serialize the value to a plain object or string before marshaling."],"exampleFix":"// before\n[JSImport(\"globalThis.fns.run\")]\nstatic partial void Run(object cb);\nRun(callbackFn); // JS function -> error\n\n// after\n[JSImport(\"globalThis.fns.run\")]\nstatic partial void Run([JSMarshalAsAttribute<JSType.Function>] Action cb);","handlingStrategy":"type-guard","validationCode":"function prepare(value: unknown): unknown {\n    if (typeof value === \"function\") {\n        throw new TypeError(\"Pass a delegate marshaler for callbacks, not object\");\n    }\n    return value;\n}","typeGuard":"const isPlainDataForCsObject = (v: unknown): boolean =>\n    v === null || v === undefined ||\n    [\"string\", \"number\", \"boolean\"].includes(typeof v) ||\n    (typeof v === \"object\" && typeof (v as any) !== \"function\");","tryCatchPattern":null,"preventionTips":["Use delegate/Action parameters for callbacks instead of object.","Validate interop argument types in a wrapper layer before calling C#."],"tags":["marshaling","jsobject","interop","type-mismatch","function"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}