dotnet/runtime · error · Error
NotImplementedException: TypedArray
Error message
NotImplementedException: TypedArray
What it means
marshal_cs_object_to_cs supports only Uint8Array, Float32Array, Float64Array, Int32Array and plain Array as array-like objects. Other TypedArray variants (Int8Array, Int16Array, Uint8ClampedArray, Uint16Array, Uint32Array) hit the else-branch and throw NotImplementedException: TypedArray.
Source
Thrown at src/mono/browser/runtime/marshal-to-cs.ts:417
} else if (value instanceof Error) {
marshal_exception_to_cs(arg, value);
} else if (value instanceof Uint8Array) {
marshal_array_to_cs_impl(arg, value, MarshalerType.Byte);
} else if (value instanceof Float32Array) {
marshal_array_to_cs_impl(arg, value, MarshalerType.Single);
} else if (value instanceof Float64Array) {
marshal_array_to_cs_impl(arg, value, MarshalerType.Double);
} else if (value instanceof Int32Array) {
marshal_array_to_cs_impl(arg, value, MarshalerType.Int32);
} else if (Array.isArray(value)) {
marshal_array_to_cs_impl(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)) {
marshal_task_to_cs(arg, value);
} else if (value instanceof Span) {
throw new Error("NotImplementedException: Span");
} else if (js_type == "object") {
const js_handle = mono_wasm_get_js_handle(value);
set_arg_type(arg, MarshalerType.JSObject);
if (BuildConfiguration === "Debug" && Object.isExtensible(value)) {
value[proxy_debug_symbol] = `JS Object with JSHandle ${js_handle}`;
}
set_js_handle(arg, js_handle);
} else {
throw new Error(`JSObject proxy is not supported for ${js_type} ${value}`);
}
} else {
assert_not_disposed(value);
if (value instanceof ArraySegment) {
throw new Error("NotImplementedException: ArraySegment. " + jsinteropDoc);View on GitHub (pinned to 290d5ab72c)
Solutions
- Convert the array to one of the supported views: Uint8Array, Int32Array, Float32Array, Float64Array, or a plain Array.
- If the C# parameter should be a typed buffer, declare it as byte[]/int[]/float[]/double[] so the matching array marshaler is selected.
Example fix
// before dotnet.jsExports.Take(new Uint16Array([1,2,3])); // throws // after dotnet.jsExports.Take(new Uint8Array([1,2,3])); // or declare C# param as ushort[] via a supported element type
Defensive patterns
Strategy: type-guard
Validate before calling
const UNSUPPORTED = new Set([Int8Array, Int16Array, Uint16Array, Uint32Array, Uint8ClampedArray]);
for (const T of UNSUPPORTED) if (value instanceof T) throw new TypeError(`${T.name} is not supported by the object marshaler; use Uint8Array/Int32Array/Float32Array/Float64Array/Array.`); Type guard
function isSupportedTypedArray(v: unknown): v is Uint8Array | Int32Array | Float32Array | Float64Array { return v instanceof Uint8Array || v instanceof Int32Array || v instanceof Float32Array || v instanceof Float64Array; } Prevention
- Stick to Uint8Array, Int32Array, Float32Array, Float64Array, or plain Array for interop.
- Declare the C# parameter as the matching element type (byte[]/int[]/float[]/double[]) so the right marshaler is chosen.
- Repack Int8/Int16/Uint16/Uint32 data into a supported view before crossing to C#.
When it happens
Trigger: Passing an Int8Array, Uint16Array, Int16Array, Uint8ClampedArray, or Uint32Array to a C# [JSExport] parameter typed as object/JSObject.
Common situations: Using a Uint16Array or Int16Array for audio/graphics data; picking a TypedArray width that is not in the supported set when calling loosely-typed interop.
Related errors
- NotImplementedException: bigint
- JSObject proxy is not supported for ${js_type} ${value}
- NotImplementedException ${element_type}
- NotImplementedException: TypedArray
- ${function_name} must be a Function but was ${typeof fn}
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/a2e6a9a3c2c090ab.
Report an issue: GitHub.