Forum Xamarin.iOS

Protocol inline hides inherited member on lvl3 inheritance.

LucasTeixeiraLucasTeixeira USMember ✭✭
edited July 2016 in Xamarin.iOS

I'm not sure to be posting on the right forum.

I'm redoing a binding for a library and I have a situation similar to this one:

` [Protocol, Model]
interface Data1
{
[Abstract]
[Export("Info")]
int Info { get; }
}

[BaseType(typeof(NSObject))]
interface ProviderLvl1 : Data1
{
    [Export("Info")]
    int Info { get; set; }
}

[Protocol, Model]
interface Data2 : Data1
{

}


[BaseType(typeof(ProviderLvl1))]
interface ProviderLvl2 : Data2
{

}

[Protocol, Model]
interface Data3 : Data2
{

}


[BaseType(typeof(ProviderLvl2))]
interface ProviderLvl3 : Data3
{

}`

ProviderLvl2 inherit Info defined in ProviderLvl1
But ProviderLvl hides it, by (I suppose) inlining Data3 members.

Is there a solutions that doesn't involve re-hiding the member?

Answers

  • LucasTeixeiraLucasTeixeira USMember ✭✭

    I realize I forgot to show the output of it:

    IData1 is just ok:

    [Protocol (Name = "Data1", WrapperType = typeof(Data1Wrapper)), ProtocolMember (IsRequired = true, IsProperty = true, IsStatic = false, Name = "Info", Selector = "Info", PropertyType = typeof(int), GetterSelector = "Info", ArgumentSemantic = ArgumentSemantic.None)] public interface IData1 : INativeObject, IDisposable { [Preserve (Conditional = true)] int Info { [Export ("Info")] get; } }

    ProviderLvl1 is just ok as well:

    [Register ("ProviderLvl1", true)] public class ProviderLvl1 : NSObject, IData1, INativeObject, IDisposable { ... [CompilerGenerated] public virtual int Info { [Export ("Info")] get; [Export ("setInfo:")] set; } ... }

    IData2 and ProviderLvl2 are ok and don't override (new) members:

    [Protocol (Name = "Data2", WrapperType = typeof(Data2Wrapper))] public interface IData2 : INativeObject, IDisposable, IData1 { }

    [Register ("ProviderLvl2", true)] public class ProviderLvl2 : ProviderLvl1, IData1, IData2, INativeObject, IDisposable { ... }

    IData3:

    [Protocol (Name = "Data3", WrapperType = typeof(Data3Wrapper))] public interface IData3 : INativeObject, IDisposable, IData1, IData2 { }

    The problem happens when it gets to ProviderLvl3, when members are inlined again:

    [Register ("ProviderLvl3", true)] public class ProviderLvl3 : ProviderLvl2, IData1, IData2, IData3, INativeObject, IDisposable { ... [CompilerGenerated] public new virtual int Info { [Export ("Info")] get; } ... }

Sign In or Register to comment.