Bug 11694 - differences in implementing an interface on Windows, MonoForAndroid, and MonoTouch
Summary: differences in implementing an interface on Windows, MonoForAndroid, and Mono...
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-04-09 22:45 UTC by Has
Modified: 2013-04-11 06:08 UTC (History)
4 users (show)

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

test.cs (692 bytes, application/octet-stream)
2013-04-10 06:51 UTC, Rolf Bjarne Kvinge [MSFT]

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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Has 2013-04-09 22:45:16 UTC
I am porting some old code that I have on Windows Mobile. The code compiles fine for .NET 3.5 CE. I created a project in MonoForAndroid and referenced the same code (.cs files refereneced as Links) and it builds fine for Android.

However, when I created a project for MonoTouch and referenced the same C# code files, it cannot build throwing an error saying that a method is not implemented.

Here is what I have:

public interface IJobController
   IUser User {get; }

public class BaseController 
   public virtual IUser User {get;set;}

public class BaseJobController : BaseController
   public new User User {get;set;}

public class JobController : BaseJobController, IJobController
  // some code here that uses the User property  
The error says that JobController does not implement method IUser User { get;} The candidate is the one in BaseJobController but the type does not match IUser against User.

This same code has been working for many years on Windows Mobile .NET 3.5 CE and the same code compiles fine on MonoForAndroid. However, it cannot compile on MonoTouch.

My concern is that there are differences in the way inheritance and Interface-Implementation implemented in MonoTouch, I have lots of work ahead (lots of code to port), so should I expect more surprises like this??
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-04-10 06:51:32 UTC
Created attachment 3795 [details]

Added complete test case.

I can reproduce this with Mono 3.0.8 too, not only MonoTouch.
Comment 2 Marek Safar 2013-04-11 06:08:13 UTC
Fixed in master (didn't make to 3.0.10)