[mono] Expanding a marshaller error message (#88726)
authorJan Dupej <109523496+jandupej@users.noreply.github.com>
Wed, 12 Jul 2023 23:09:20 +0000 (01:09 +0200)
committerGitHub <noreply@github.com>
Wed, 12 Jul 2023 23:09:20 +0000 (18:09 -0500)
* Expanding error message in #46926

* Removing unnecessary code.

src/mono/mono/metadata/marshal-lightweight.c

index 8871b2f..dda7462 100644 (file)
@@ -2504,7 +2504,11 @@ emit_managed_wrapper_ilgen (MonoMethodBuilder *mb, MonoMethodSignature *invoke_s
 
        if (!sig->hasthis && sig->param_count != invoke_sig->param_count) {
                /* Closed delegate */
-               g_assert (sig->param_count == invoke_sig->param_count + 1);
+               if (sig->param_count != invoke_sig->param_count + 1) {
+                       g_warning ("Closed delegate has incorrect number of arguments: %s.", mono_method_full_name (method, TRUE));
+                       g_assert_not_reached ();
+               }
+
                closed = TRUE;
                /* Use a new signature without the first argument */
                sig = mono_metadata_signature_dup (sig);