@@ -22,7 +22,6 @@ import { _zero_region, localHeapViewF64, localHeapViewI32, localHeapViewU8 } fro
2222import { stringToMonoStringRoot , stringToUTF16 } from "./strings" ;
2323import { JSMarshalerArgument , JSMarshalerArguments , JSMarshalerType , MarshalerToCs , MarshalerToJs , BoundMarshalerToCs , MarshalerType } from "./types/internal" ;
2424import { TypedArray } from "./types/emscripten" ;
25- import { gc_locked } from "./gc-lock" ;
2625
2726export const jsinteropDoc = "For more information see https://aka.ms/dotnet-wasm-jsinterop" ;
2827
@@ -224,6 +223,7 @@ function _marshal_string_to_cs_impl (arg: JSMarshalerArgument, value: string) {
224223 set_arg_intptr ( arg , buffer ) ;
225224 set_arg_length ( arg , value . length ) ;
226225 } else {
226+ mono_assert ( ! WasmEnableThreads , "Marshaling strings by reference is not supported in multithreaded mode" ) ;
227227 const root = get_string_root ( arg ) ;
228228 try {
229229 stringToMonoStringRoot ( value , root ) ;
@@ -463,7 +463,7 @@ export function marshal_array_to_cs_impl (arg: JSMarshalerArgument, value: Array
463463 mono_check ( Array . isArray ( value ) , "Value is not an Array" ) ;
464464 _zero_region ( buffer_ptr , buffer_length ) ;
465465 if ( ! WasmEnableJsInteropByValue ) {
466- mono_assert ( ! WasmEnableThreads || ! gc_locked , "GC must not be locked when creating a GC root " ) ;
466+ mono_assert ( ! WasmEnableThreads , "Marshaling strings by reference is not supported in multithreaded mode " ) ;
467467 cwraps . mono_wasm_register_root ( buffer_ptr , buffer_length , "marshal_array_to_cs" ) ;
468468 }
469469 for ( let index = 0 ; index < length ; index ++ ) {
@@ -474,7 +474,7 @@ export function marshal_array_to_cs_impl (arg: JSMarshalerArgument, value: Array
474474 mono_check ( Array . isArray ( value ) , "Value is not an Array" ) ;
475475 _zero_region ( buffer_ptr , buffer_length ) ;
476476 if ( ! WasmEnableJsInteropByValue ) {
477- mono_assert ( ! WasmEnableThreads || ! gc_locked , "GC must not be locked when creating a GC root " ) ;
477+ mono_assert ( ! WasmEnableThreads , "Marshaling objects by reference is not supported in multithreaded mode " ) ;
478478 cwraps . mono_wasm_register_root ( buffer_ptr , buffer_length , "marshal_array_to_cs" ) ;
479479 }
480480 for ( let index = 0 ; index < length ; index ++ ) {
0 commit comments