dotnet/runtime · error · Error
not implemented
Error message
not implemented
What it means
Thrown by marshal_array_to_cs_impl() as the final else when the array element_type does not match any supported type (String, Object, JSObject, Byte, Int32, Double, Single). The function iterates through known element types and throws 'not implemented' for anything unrecognized. This is a low-level marshaling error indicating the array marshaler received an element type it was not built to handle.
Solutions
- Use a supported array element type on the C# side: string[], object[], byte[], int[], double[], or float[].
- For long[], change the C# parameter type and use long[] with the BigInt64 marshaler, or convert to int[] if values fit.
- For char[] or short[], convert to byte[] or int[] on the JS side before passing.
- Ensure your dotnet runtime and C# assemblies are from the same version/build to avoid marshaler type mismatches.
Example fix
// before (unsupported array element type)
// C#: [JSExport] public static void Process(char[] data) { }
// after (use supported type)
// C#: [JSExport] public static void Process(int[] data) { }
// JS: Process(Array.from(charArray, c => c.charCodeAt(0))); Defensive patterns
Strategy: validation
Validate before calling
// Validate array element type before marshaling
const supportedArrayElementTypes = new Set(['String', 'Object', 'JSObject', 'Byte', 'Int32', 'Double', 'Single']);
function isSupportedArrayElementType(type: string): boolean {
return supportedArrayElementTypes.has(type);
}
// Ensure C# uses supported array element types
// char[] -> int[], short[] -> int[], decimal[] -> double[], etc. Prevention
- Use supported array element types: string[], int[], byte[], double[], float[], object[].
- Convert unsupported types (char[], short[], bool[], long[]) to supported types before interop.
- Keep the C# interop signatures and JS runtime package version-aligned.
When it happens
Trigger: Calling marshal_array_to_cs or marshal_array_to_cs_impl with an element_type that is not one of: String, Object, JSObject, Byte, Int32, Double, or Single. This is typically caused by a C# signature that uses an unsupported array element type, or by internal marshaler binding logic producing an unrecognized type code.
Common situations: Declaring a C# JSImport/JSExport with an array parameter of an unsupported element type (e.g., char[], short[], decimal[], long[]). A mismatch between the C# signature and the JS values being marshaled. Internal type-resolution issues from an outdated or mismatched runtime build.
Related errors
- NotImplementedException
- JSObject proxy is not supported for
- NotImplementedException: ArraySegment. For more information…
- NotImplementedException: bigint
- NotImplementedException
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/2877a7d8b34466d1.
Report an issue: GitHub.
Appendix: source
Thrown at src/mono/browser/runtime/marshal-to-cs.ts:512
const targetView = localHeapViewU8().subarray(<any>buffer_ptr, buffer_ptr + length);
targetView.set(value);
} else if (element_type == MarshalerType.Int32) {
mono_check(Array.isArray(value) || value instanceof Int32Array, "Value is not an Array or Int32Array");
const bufferOffset = fixupPointer(buffer_ptr, 2);
const targetView = localHeapViewI32().subarray(bufferOffset, bufferOffset + length);
targetView.set(value);
} else if (element_type == MarshalerType.Double) {
mono_check(Array.isArray(value) || value instanceof Float64Array, "Value is not an Array or Float64Array");
const bufferOffset = fixupPointer(buffer_ptr, 3);
const targetView = localHeapViewF64().subarray(bufferOffset, bufferOffset + length);
targetView.set(value);
} else if (element_type == MarshalerType.Single) {
mono_check(Array.isArray(value) || value instanceof Float32Array, "Value is not an Array or Float32Array");
const bufferOffset = fixupPointer(buffer_ptr, 2);
const targetView = localHeapViewF32().subarray(bufferOffset, bufferOffset + length);
targetView.set(value);
} else {
throw new Error("not implemented");
}
set_arg_intptr(arg, buffer_ptr);
set_arg_type(arg, MarshalerType.Array);
set_arg_element_type(arg, element_type);
set_arg_length(arg, value.length);
}
}
function _marshal_span_to_cs (arg: JSMarshalerArgument, value: Span, element_type?: MarshalerType): void {
mono_assert(!!element_type, "Expected valid element_type parameter");
mono_check(!value.isDisposed, "ObjectDisposedException");
checkViewType(element_type, value._viewType);
set_arg_type(arg, MarshalerType.Span);
set_arg_intptr(arg, value._pointer);
set_arg_length(arg, value.length);
}
View on GitHub (pinned to 60108ba66e)