Mono/Nunit issues

mleatherb
Tue, 24 Oct 2017 12:45:35 +0000
Question & Answer

So we are running into this issue when running unit tests

github.com/mono/mono

[sre] register a canonical MonoReflectionMethod for a methodref token

committed 06:01PM - 27 Sep 17 UTC

lambdageek

+24 -2

In mono_image_create_token we are passed in a managed reflection object and we n…eed to create a token for it and optionally register it so that we can resolve that token back to a runtime structure and managed object later. For a MonoReflectionMethod object that refers to a method from outside the current dynamic image, we need to generate a memberref token. It will be the same token for the same underlying MonoMethod*. When we go to register the token with mono_dynamic_image_register_token we need to pass a managed object. Unfortunately two MonoReflectionMethod objects could refer to the same MonoMethod* but differ in their ReflectedType, so just registering the passed-in MonoReflectionMethod means we could assert in mono_dynamic_image_register_token because previously we may have registered the same method via a different ReflectedType. So what we do is we cal mono_method_get_object_handle with NULL for the reflected type - which corresponds to just using the DeclaringType of the given MonoMethod*. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59364

Will this mono update be included in this coming weekends update?

2 posts - 2 participants