[Mono-dev] Embedded API: .ctor method signature query

Robert Jordan robertj at gmx.net
Thu Mar 3 18:00:11 UTC 2016


On 03.03.2016 14:36, Jonathan Mitchell wrote:
> HI
>
> I want to call the following constructor via the embedded API:
>
> public CloudClient(Func<string, string> filePathCallback)
>
> All my other embedded method and constructor calls work okay but there is an issue with this one - it is the only place I use a System.Func<T>.
> The API reports that a method cannot be found for signature .ctor(System.Func`2<string, string>)
> When I dump out the class method names I see .ctor(System.Func`2<string, string>) listed.
>
> Any ideas on this one?

It looks like a bug in mono_method_desc_new ():

https://github.com/mono/mono/blob/master/mono/metadata/debug-helpers.c#L378

The function is treating

	.ctor(System.Func`2<string, string>)

like a method with 2 arguments:

arg0 = System.Func`2<string
arg1 = string>

This is obviously wrong :)

The function is then storing the (wrong) argument count
for optimization purposes, and the comparison of methods
is starting to fail:

https://github.com/mono/mono/blob/master/mono/metadata/debug-helpers.c#L447

Robert




More information about the Mono-devel-list mailing list