Skip to content

Commit 79a5689

Browse files
committed
Use empty array for wrapper methods (case 1073634)
Wrapper methods should not be exposed to user code but in some cases they end up in StackFrame's. Return empty parameter array in these cases since metadata code cannot handle wrapper methods.
1 parent a098bd2 commit 79a5689

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mono/metadata/reflection.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,15 @@ mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoCla
10871087
return res;
10881088
}
10891089

1090+
/* UNITY: wrapper methods are being captured in callstacks, even thought users should not encounter them.
1091+
* The logic in param_objects_construct cannot handle this. Just return empty array (case 1073634) */
1092+
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
1093+
MonoArrayHandle res = mono_array_new_handle (domain, mono_class_get_mono_parameter_info_class (), 0, error);
1094+
goto_if_nok (error, fail);
1095+
1096+
return res;
1097+
}
1098+
10901099
/* Note: the cache is based on the address of the signature into the method
10911100
* since we already cache MethodInfos with the method as keys.
10921101
*/

0 commit comments

Comments
 (0)