Skip to content

[wasm][AOT] null function or function signature mismatch - #119143

Description

@pavelsavara

Simplest repro is AOT build of

Activator.CreateInstance(typeof(Queue), new[] { new List<Nullable<Int128>>(){0,null} });

Originally from NumberHandlingTestsDynamic.Number_AsCollectionElement_RoundTrip

obj = Activator.CreateInstance(type, new[] { list });
serialized = await Serializer.SerializeWrapper(obj, s_optionReadAndWriteFromStr);

Log

[21:25:54] fail: MONO_WASM: null function or function signature mismatch
                 RuntimeError: null function or function signature mismatch
                     at aot_instances_aot_wrapper_gsharedvt_out_sig_obj_cl4c_Mono_dValueTuple_602_3cbyte_2c_20Mono_dValueTuple_602_3clong_2c_20long_3e_3e_ (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[64734]:0x12547d4)
                     at corlib_System_Collections_Generic_List_1_Enumerator_T_GSHAREDVT_System_Collections_IEnumerator_get_Current (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[41067]:0xa76714)
                     at ut_corlib_System_Collections_Generic_List_1_Enumerator_T_GSHAREDVT_System_Collections_IEnumerator_get_Current (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[41068]:0xa76763)
                     at System_Collections_NonGeneric_System_Collections_Queue__ctor_System_Collections_ICollection (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[10716]:0x36f692)
                     at JsonSchema_Net_aot_wrapper_gsharedvt_out_sig_void_this_obj (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[1405]:0xe20e9)
                     at jit_call_cb (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90080]:0x187fb43)
                     at mono_llvm_cpp_catch_exception (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[93365]:0x1972bf1)
                     at mono_llvm_catch_exception (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[93417]:0x1977254)
                     at do_jit_call (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90000]:0x187c659)
                     at mono_interp_exec_method (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[89995]:0x187bb1a)
                     at interp_entry (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90074]:0x187f7cc)
                     at interp_entry_static_ret_2 (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90103]:0x1880733)
                     at aot_instances_aot_wrapper_gsharedvt_in_sig_obj_objcl40_Mono_dValueTuple_601_3cMono_dValueTuple_602_3cint_2c_20int_3e_3e_ (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[64696]:0x1252fd9)
                     at corlib_wrapper_delegate_invoke__Module_invoke_object_object_Span_1_object_object_System_Span_1_object (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[41567]:0xa9241f)
                     at corlib_System_Reflection_MethodBaseInvoker_InvokeWithOneArg_object_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[36414]:0x95b605)
                     at corlib_System_Reflection_RuntimeConstructorInfo_Invoke_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[36560]:0x963d60)
                     at corlib_System_RuntimeType_CreateInstanceImpl_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[25239]:0x794d42)
                     at corlib_System_Activator_CreateInstance_System_Type_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo_object__ (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[25970]:0x7b916a)
                     at corlib_System_Activator_CreateInstance_System_Type_object__ (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[25971]:0x7b91af)
                     at aot_instances_aot_wrapper_gsharedvt_out_sig_obj_objobj (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[64654]:0x1252284)
                     at jit_call_cb (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90080]:0x187fb5b)
                     at mono_llvm_cpp_catch_exception (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[93365]:0x1972bf1)
                     at mono_llvm_catch_exception (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[93417]:0x1977254)
                     at do_jit_call (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90000]:0x187c659)
                     at mono_interp_exec_method (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[89995]:0x186f460)
                     at interp_entry (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90074]:0x187f7cc)
                     at interp_entry_instance_0 (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[90092]:0x188030a)
                     at aot_instances_aot_wrapper_gsharedvt_in_sig_void_this_ (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[64620]:0x12503b0)
                     at corlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_Start_TStateMachine_GSHAREDVT_TStateMachine_GSHAREDVT_ (http://127.0.0.1:44947/_framework/dotnet.native.wasm:wasm-function[40516]:0xa5f42d)

#66220 may be related

Activity

  1. added this to the 11.0.0 milestone on Aug 27, 2025
  2. self-assigned this
    on Aug 27, 2025
  3. dotnet-policy-service commented on Aug 27, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing
    See info in area-owners.md if you want to be subscribed.

  4. added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Aug 27, 2025
  5. added and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on Aug 27, 2025
  6. pavelsavara commented on Aug 27, 2025

    @pavelsavara
    MemberAuthor
    [MONO] AOT: FOUND method System.RuntimeType:GetConstructors (System.Reflection.BindingFlags) [0x1276 - 0x1277 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Buffer:Memmove<T> (T&,T&,uintptr) [0x1169 - 0x116a 0x106f98]
    dotnet.runtime.js:1415 [MONO] Running class .cctor for System.Collections.Generic.List`1<System.Reflection.MethodBase> from 'System.Private.CoreLib.dll'
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Collections.Generic.List`1:.cctor () [0x3832 - 0x3833 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.RuntimeType:IsArrayImpl () [0x12f2 - 0x12f3 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.DefaultBinder:BindToMethod (System.Reflection.BindingFlags,System.Reflection.MethodBase[],object[]&,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[],object&) [0x1762 - 0x1763 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Array:Clone () [0x114e - 0x114f 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.RuntimeType:IsPrimitiveImpl () [0x12f6 - 0x12f7 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.RuntimeType:GetTypeCodeImpl () [0x12f0 - 0x12f1 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Reflection.RuntimeConstructorInfo:Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x2f2b - 0x2f2c 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.RuntimeType:IsInstanceOfType (object) [0x1280 - 0x1281 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Collections.Generic.List`1<T_GSHAREDVT>:get_Count () [0x3a43 - 0x3a44 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Collections.Generic.List`1<T_GSHAREDVT>:System.Collections.IEnumerable.GetEnumerator () [0x3a4a - 0x3a4b 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: System.Collections.Generic.List`1<System.Nullable`1<System.Int128>>:System.Collections.Generic.IEnumerable<T>.GetEnumerator ().
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method (wrapper other) object:gsharedvt_in_sig (intptr) [0x508d - 0x508e 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: System.Collections.Generic.List`1<System.Nullable`1<System.Int128>>:GetEnumerator ().
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method (wrapper other) object:gsharedvt_out_sig (intptr,intptr) [0x5053 - 0x5054 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Collections.Generic.List`1/Enumerator<T_GSHAREDVT>:.ctor (System.Collections.Generic.List`1<T_GSHAREDVT>) [0x3a50 - 0x3a51 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method string:bzero (byte*,int) [0x1338 - 0x1339 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Collections.Generic.List`1/Enumerator<T_GSHAREDVT>:MoveNext () [0x3a52 - 0x3a53 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method string:memcpy (byte*,byte*,int) [0x1337 - 0x1338 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT: FOUND method System.Collections.Generic.List`1/Enumerator<T_GSHAREDVT>:System.Collections.IEnumerator.get_Current () [0x3a53 - 0x3a54 0x106f98]
    dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: System.Nullable`1<System.Int128>:Box (System.Nullable`1<System.Int128>).
    dotnet.runtime.js:1415 [MONO] AOT NOT FOUND: (wrapper other) object:gsharedvt_out_sig (intptr,Mono.ValueTuple`2<byte, Mono.ValueTuple`2<long, long>>&,intptr).
    
  7. pavelsavara commented on Aug 27, 2025

    @pavelsavara
    MemberAuthor
    $mini_get_gsharedvt_wrapper	@	mini-generic-sharing.c:2114
    $mini_llvmonly_add_method_wrappers	@	llvmonly-runtime.c:213
    $class_type_info	@	mini-generic-sharing.c:1082
    $instantiate_info	@	mini-generic-sharing.c:2244
    $instantiate_info	@	mini-generic-sharing.c:2661
    $mini_instantiate_gshared_info	@	mini-generic-sharing.c:2760
    $mini_init_method_rgctx	@	jit-icalls.c:1743
    $corlib_System_Collections_Generic_List_1_Enumerator_T_GSHAREDVT_System_Collections_IEnumerator_get_Current
    $ut_corlib_System_Collections_Generic_List_1_Enumerator_T_GSHAREDVT_System_Collections_IEnumerator_get_Current
    $System_Collections_NonGeneric_System_Collections_Queue__ctor_System_Collections_ICollection
    
  8. added a commit that references this issue on Aug 27, 2025
  9. pavelsavara commented on Aug 27, 2025

    @pavelsavara
    MemberAuthor

    I though that this is because AOT doesn't have visibility for the call, because we use reflection to call the constructor.

    So I prefixed it direct call, to make sure it's not trimmed and it's AOT generated. But it didn't help.

    var q = new Queue(new List<Nullable<Int128>>() { 42, null });

    This doesn't reproduce it either.

    List<Nullable<Int128>> n = new List<Nullable<Int128>>() { 42, null };
    foreach (object item in n)
    {
    }

    Right now I think we need something like code below, but for combination of generic and non-generic collections/enumerables.

    if (in_corlib && !strcmp (klass_name_space, "System.Collections.Generic") &&
    (!strcmp(klass_name, "ICollection`1") || !strcmp (klass_name, "IEnumerable`1") || !strcmp (klass_name, "IList`1") || !strcmp (klass_name, "IEnumerator`1") || !strcmp (klass_name, "IReadOnlyList`1"))) {
    MonoClass *tclass = mono_class_from_mono_type_internal (mono_class_get_generic_class (klass)->context.class_inst->type_argv [0]);
    MonoClass *array_class = mono_class_create_bounded_array (tclass, 1, FALSE);
    char *name_prefix;

  10. modified the milestones: 11.0.0, Future on Sep 17, 2025
  11. added a commit that references this issue on Jul 26, 2026
    d756731
  12. locked and limited conversation to collaborators on Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions