Bug 33669 - mcs emits CS1061 while csc does not (compiling class with generic virtual method and constraints)
Summary: mcs emits CS1061 while csc does not (compiling class with generic virtual met...
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 4.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2015-09-04 13:42 UTC by maxim.kropotov
Modified: 2015-09-07 10:12 UTC (History)
1 user (show)

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

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 maxim.kropotov 2015-09-04 13:42:27 UTC
When compiling with mcs, the following code causes error CS1061, while csc compiles it without errors.

public abstract class ThingWithOrganizationId
	public Guid OrganizationId;

public class Thing : ThingWithOrganizationId

public abstract class  BaseService<TConstraint> 
	public abstract void Save<T> (T newThing) where T : TConstraint;

public class DerivedService:BaseService<Thing>
	public override void Save<TThing>(TThing newThing)

This is the error message returned by the compiler:
error CS1061: Type TThing' does not contain a definition forOrganizationId' and no extension method OrganizationId' of typeTThing' could be found. Are you missing an assembly reference?

I am trying to compile this on a Mac, this is the output of  "mcs --version":
>Mono C# compiler version

I am not sure this is a minimal reproduction, but this is the shortest example I've been able to produce.
Moving OrganizationId to the derived Thing class causes this to compile without errors, so does making Save a non-virtual method.
Comment 1 Marek Safar 2015-09-07 10:12:25 UTC
Fixed in master