[Mono-dev] Embedded API: .ctor method signature query [mono]
Jonathan Mitchell
lists at mugginsoft.com
Thu Mar 3 18:28:46 UTC 2016
HI Robert
Thanks for that.
I think you are right.
I call hundreds of methods that take Obj`1<T> arguments with out issue but I see that I have had to construct a number of helper methods to deal with cases of Obj`2<T, K> which failed signature resolution.
I presume that managed code execution doesn’t involve calls to mono_method_desc_new() - are thunks used instead?
One of the difficulties, I find, of working with the embedded API is trying to visualise just how a particular managed code statement is implemented within the runtime.
I was hoping to be able to call the constructor from C with a pointer to a static (MonoString *)fund(MonoString *).
Not sure if that would even fly.
As a work around I will use an internal call.
Shall I log this as a bug and reference this thread?
Thanks a lot for replying.
Jonathan
> On 3 Mar 2016, at 18:02, Robert Jordan <robertj at gmx.net> wrote:
>
> 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