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

Jonathan Mitchell lists at mugginsoft.com
Fri Mar 4 15:11:44 UTC 2016


HI Robert

> 
> You may want to file a bug, though.

Bug is in at:
https://bugzilla.xamarin.com/show_bug.cgi?id=39343

After logging the bug I managed to fix it myself on my current target 4.0.0. 
https://github.com/mono/mono/pull/2724

4.2.0 will need this too.

Jonathan
> 
> Robert
> 
> 
> On 03.03.2016 19:28, Jonathan Mitchell wrote:
>> 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
>>> 
>>> 
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list