dotnet/runtime · error · Error
NotImplementedException: TypedArray
Error message
NotImplementedException: TypedArray
What it means
Thrown by marshalCsObjectToCs for typed arrays that the generic object marshaler explicitly does not support: Int8Array, Int16Array, Uint8ClampedArray, Uint16Array, and Uint32Array. Only Uint8Array, Float32Array, Float32Array, Float64Array, and Int32Array are accepted there; the unsupported views intentionally throw rather than silently coerce.
Source
Thrown at src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/marshal-to-cs.ts:388
} else if (value instanceof Error) {
marshalExceptionToCs(arg, value);
} else if (value instanceof Uint8Array) {
marshalArrayToCsImpl(arg, value, MarshalerType.Byte);
} else if (value instanceof Float64Array) {
marshalArrayToCsImpl(arg, value, MarshalerType.Double);
} else if (value instanceof Float32Array) {
marshalArrayToCsImpl(arg, value, MarshalerType.Single);
} else if (value instanceof Int32Array) {
marshalArrayToCsImpl(arg, value, MarshalerType.Int32);
} else if (Array.isArray(value)) {
marshalArrayToCsImpl(arg, value, MarshalerType.Object);
} else if (value instanceof Int16Array
|| value instanceof Int8Array
|| value instanceof Uint8ClampedArray
|| value instanceof Uint16Array
|| value instanceof Uint32Array
) {
throw new Error("NotImplementedException: TypedArray");
} else if (isThenable(value)) {
marshalTaskToCs(arg, value);
} else if (value instanceof Span) {
throw new Error("NotImplementedException: Span");
} else if (jsType == "object") {
const jsHandle = getJsHandleFromJSObject(value);
setArgType(arg, MarshalerType.JSObject);
if (BuildConfiguration === "Debug" && Object.isExtensible(value)) {
value[proxyDebugSymbol] = `JS Object with JSHandle ${jsHandle}`;
}
setJsHandle(arg, jsHandle);
} else {
throw new Error(`JSObject proxy is not supported for ${jsType} ${value}`);
}
} else {
assertNotDisposed(value);
if (value instanceof ArraySegment) {
throw new Error("NotImplementedException: ArraySegment. " + jsinteropDoc);View on GitHub (pinned to 290d5ab72c)
Solutions
- Remap the buffer to a supported view: new Uint8Array(otherArray.buffer) for byte data, new Int32Array(...) for 32-bit, etc.
- Change the C# signature to use Span<byte>/byte[] or the matching supported element type.
- For 16-bit data, expand to Int32Array or pack into Uint8Array and reinterpret in C#.
Example fix
// before const data = new Uint16Array(...); interop.ProcessObject(data); // C# object param // after const data = new Uint8Array(raw.buffer); interop.ProcessBytes(data); // C# byte[] / Span<byte>
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_VIEWS = [Uint8Array, Int32Array, Float32Array, Float64Array];
function asCsObject(value: unknown): unknown {
if (ArrayBuffer.isView(value) && !SUPPORTED_VIEWS.some(t => value instanceof t)) {
const v = value as TypedArray;
return new Uint8Array(v.buffer, v.byteOffset, v.byteLength); // remap to byte view
}
return value;
} Type guard
const isSupportedTypedArray = (v: unknown): boolean =>
v instanceof Uint8Array || v instanceof Int32Array ||
v instanceof Float32Array || v instanceof Float64Array; Prevention
- Standardize on Uint8Array/Int32Array/Float32Array/Float64Array at the JS↔C# boundary.
- Add a lint rule or wrapper that rejects Int8Array/Int16Array/Uint16Array/Uint32Array/Uint8ClampedArray for interop.
When it happens
Trigger: Passing an Int16Array/Uint16Array/Uint32Array/Int8Array/Uint8ClampedArray as an `object` argument to a C# interop method, or returning one from a JS function imported with object marshaling.
Common situations: Working with Web Audio or canvas pixel data (Uint16Array/Uint32Array) and forwarding buffers straight to C#; porting code that used these arrays on the JS side without remapping to the supported set.
Related errors
- NotImplementedException: TypedArray
- NotImplementedException ${element_type}
- NotImplementedException: bigint
- NotImplementedException: Span
- JSObject proxy is not supported for ${jsType} ${value}
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/c34f52c1122bd503.
Report an issue: GitHub.