On 15 Jul 2014, at 14:50, Robert Jordan <[email protected]> wrote:
> On 15.07.2014 13:24, Jonathan Mitchell wrote:
>> Hi
>>
>> I have a class that implements the following two interfaces and I am having
>> trouble accessing explicit interface properties via the embedded API.
>
> IIRC, the name of properties (and methods) of explicit interfaces
> must be prefixed with the interface name, e.g.:
>
> [self getMonoProperty:"IReferenceObject2_ExIntTestProperty"]
>
> I'm not sure about the delimiter, but I believe it's "_".
Thanks for the tip.
Looking at the ReferenceObject I can see that there is a namespace + interface
name prefix before the getter and setter functions.
2014-07-15 15:55:10.904 otest[16383:303] Method name:
Dubrovnik.UnitTests.ReferenceObject:get_ExIntTestProperty ()
2014-07-15 15:55:10.904 otest[16383:303] Method name:
Dubrovnik.UnitTests.ReferenceObject:set_ExIntTestProperty (bool)
2014-07-15 15:55:10.904 otest[16383:303] Method name:
Dubrovnik.UnitTests.ReferenceObject:Dubrovnik.UnitTests.IReferenceObject2.get_ExIntTestProperty
()
2014-07-15 15:55:10.905 otest[16383:303] Method name:
Dubrovnik.UnitTests.ReferenceObject:Dubrovnik.UnitTests.IReferenceObject2.set_ExIntTestProperty
(single)
2014-07-15 15:55:10.905 otest[16383:303] Method name:
Dubrovnik.UnitTests.ReferenceObject:Dubrovnik.UnitTests.IReferenceObject1.get_ExIntTestProperty
()
2014-07-15 15:55:10.905 otest[16383:303] Method name:
Dubrovnik.UnitTests.ReferenceObject:Dubrovnik.UnitTests.IReferenceObject1.set_ExIntTestProperty
(int)
When using the IReferenceObject1 I see the accessors without the prefix and
reporting the correct argument type.
To me it looks like we are good to go - but the the unit test still fails.
Perhaps I am sort of expecting the C API to behave like its managed counterpart
in this case and allow me to access the explicit property through the interface.
I also build my property get method names up explicitly from the property name
rather than using mono_class_get_property_from_name.
I will have to dig into this a bit more.
2014-07-15 16:01:44.555 otest[16444:303] Method count : 2
2014-07-15 16:01:44.555 otest[16444:303] Method name:
Dubrovnik.UnitTests.IReferenceObject1:get_ExIntTestProperty ()
2014-07-15 16:01:44.556 otest[16444:303] Method name:
Dubrovnik.UnitTests.IReferenceObject1:set_ExIntTestProperty (int)
IReferenceObject2
2014-07-15 16:01:44.557 otest[16444:303] Method name:
Dubrovnik.UnitTests.IReferenceObject2:get_ExIntTestProperty ()
2014-07-15 16:01:44.558 otest[16444:303] Method name:
Dubrovnik.UnitTests.IReferenceObject2:set_ExIntTestProperty (single)
Jonathan
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list