Skip to content

Commit 2eaf5ba

Browse files
author
Josh Peterson
committed
Don't assume an Invoke method (case 1075581)
The delegate begin invoke implementation needs to determine whether it should invoke a method or a delegate. Previously, it assumed the presence of a method named `Invoke` on the declaring type of the method meant that type was a delegate. Of course, the user can name a method `Invoke`! If that happened, the method was never really called, because that `Invoke` method was called instead.
1 parent 9efadd4 commit 2eaf5ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mono/metadata/threadpool.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@ mono_threadpool_begin_invoke (MonoDomain *domain, MonoObject *target, MonoMethod
432432

433433
error_init (error);
434434

435-
message = mono_method_call_message_new (method, params, mono_get_delegate_invoke (method->klass), (params != NULL) ? (&async_callback) : NULL, (params != NULL) ? (&state) : NULL, error);
435+
MonoMethod* invoke = NULL;
436+
if (mono_class_is_delegate(method->klass->parent))
437+
invoke = mono_get_delegate_invoke (method->klass);
438+
439+
message = mono_method_call_message_new (method, params, invoke, (params != NULL) ? (&async_callback) : NULL, (params != NULL) ? (&state) : NULL, error);
436440
return_val_if_nok (error, NULL);
437441

438442
async_call = (MonoAsyncCall*) mono_object_new_checked (domain, async_call_klass, error);

0 commit comments

Comments
 (0)