dotnet/runtime · error · Error
NotImplementedException ${element_type}. For more informatio
Error message
NotImplementedException ${element_type}. For more information see https://aka.ms/dotnet-wasm-jsinterop What it means
_marshal_array_to_js builds a JS array from a C# array. Supported element types are String, Object, JSObject, Byte, Int32, Double, and Single. Any other MarshalerType reaches the default branch and throws, naming the unsupported element_type.
Source
Thrown at src/mono/browser/runtime/marshal-to-js.ts:544
}
} else if (element_type == MarshalerType.Byte) {
const bufferOffset = fixupPointer(buffer_ptr, 0);
const sourceView = localHeapViewU8().subarray(bufferOffset, bufferOffset + length);
result = sourceView.slice();//copy
} else if (element_type == MarshalerType.Int32) {
const bufferOffset = fixupPointer(buffer_ptr, 2);
const sourceView = localHeapViewI32().subarray(bufferOffset, bufferOffset + length);
result = sourceView.slice();//copy
} else if (element_type == MarshalerType.Double) {
const bufferOffset = fixupPointer(buffer_ptr, 3);
const sourceView = localHeapViewF64().subarray(bufferOffset, bufferOffset + length);
result = sourceView.slice();//copy
} else if (element_type == MarshalerType.Single) {
const bufferOffset = fixupPointer(buffer_ptr, 2);
const sourceView = localHeapViewF32().subarray(bufferOffset, bufferOffset + length);
result = sourceView.slice();//copy
} else {
throw new Error(`NotImplementedException ${element_type}. ${jsinteropDoc}`);
}
free(<any>buffer_ptr);
return result;
}
function _marshal_span_to_js (arg: JSMarshalerArgument, element_type?: MarshalerType): Span {
mono_assert(!!element_type, "Expected valid element_type parameter");
const buffer_ptr = get_arg_intptr(arg);
const length = get_arg_length(arg);
let result: Span | null = null;
if (element_type == MarshalerType.Byte) {
result = new Span(<any>buffer_ptr, length, MemoryViewType.Byte);
} else if (element_type == MarshalerType.Int32) {
result = new Span(<any>buffer_ptr, length, MemoryViewType.Int32);
} else if (element_type == MarshalerType.Double) {
result = new Span(<any>buffer_ptr, length, MemoryViewType.Double);
} else if (element_type == MarshalerType.Single) {View on GitHub (pinned to 290d5ab72c)
Solutions
- Change the C# element type to one supported by JS interop: string, int, double, float, byte, JSObject/object, or a Task.
- For long elements, return long[] is unsupported; marshal as a typed buffer (Span<long> is also unsupported, so use int[]/double[] or split).
- Project structs into plain objects (object[]) or JSON strings before crossing to JS.
Example fix
// C# before
[JSExport] public static bool[] GetFlags() => new[] { true, false };
// after
[JSExport] public static int[] GetFlags() => new[] { 1, 0 }; Defensive patterns
Strategy: fallback
Try / catch
try { return dotnet.jsExports.GetArray(); } catch (e) { if (String(e?.message).startsWith('NotImplementedException') && String(e?.message).includes('https://aka.ms/dotnet-wasm-jsinterop')) { return JSON.parse(dotnet.jsExports.GetArrayJson()); } throw e; } Prevention
- Return arrays of supported element types (string, int, double, float, byte, object, JSObject).
- For unsupported element types, serialize to JSON or project into a supported array on the C# side.
- Avoid bool[]/long[]/short[]/struct[] across the JS boundary.
When it happens
Trigger: A C# method returns or marshals an array whose element type is not in the supported set (e.g. an array of a struct, enum with unsupported backing, bool[], short[], long[]). The element_type is set by the C# signature.
Common situations: Declaring a [JSExport] return type of T[] where T is unsupported by the JS marshaler; returning bool[] or long[] arrays.
Related errors
- not implemented
- NotImplementedException ${elementType}. For more information
- NotImplementedException: bigint
- NotImplementedException: TypedArray
- NotImplementedException: Span
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/a1b25dda8727364c.
Report an issue: GitHub.