Bug 46812 - iOS Binding Library: Protocol inline hides inherited member on lvl3 inheritance
Summary: iOS Binding Library: Protocol inline hides inherited member on lvl3 inheritance
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-11 17:47 UTC by Flash3001
Modified: 2017-02-15 22:30 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Case (5.10 KB, application/zip)
2017-02-15 22:29 UTC, Alex Soto [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 46812 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Flash3001 2016-11-11 17:47:07 UTC
I've posted it on Forums, but got no answer. https://forums.xamarin.com/discussion/72120/protocol-inline-hides-inherited-member-on-lvl3-inheritance#latest

I seems to be a bug, not a feature. So posting here as well. 

Given the following definition:

------------BEGIN CODE----------------

[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 { }

-------------END CODE-----------------

The result is: 

------------BEGIN CODE----------------

    [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;
        }
    }

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

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

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

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

// So far it's all OK. The problem is now:

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

-------------END CODE-----------------

Data1 protocol is inlined in ProviderLvl1 as expected. Data2 protocol isn't inlined in ProviderLvl2 as its members already exists. But Data3 protocol gets inlined in ProviderLvl3, behaving differently from Data2 protocol.
Comment 1 Flash3001 2016-11-11 17:54:18 UTC
Xamarin.iOS
Version: 10.2.0.4 (Xamarin Studio Community)
Hash: b638977
Branch: xcode8.1
Build date: 2016-10-25 14:38:48-0400
Comment 2 Alex Soto [MSFT] 2017-02-15 22:29:54 UTC
Created attachment 19835 [details]
Test Case