Bug 14779 - Linked files in complex project structures
Summary: Linked files in complex project structures
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2013-09-16 12:00 UTC by Matthijs Koopman
Modified: 2017-04-24 02:55 UTC (History)
3 users (show)

Tags: compiler, linked files
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 Developer Community or GitHub 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 Matthijs Koopman 2013-09-16 12:00:50 UTC
I've a project setup like this:

>> This shared project contains .cs files that will be added to the other projects using linked files. Most of these files contain partial classes.

>> Core iOS project that will include files from the shared project using linked files. And also contains the other half of the partial class defined in the shared project.

>> A project that online consists of linked files from both the Sample.Shared and the Sample.iOS.Core project.

When working with a project structure like this and lots of files aprox. somewhere between 1000 and 1500 files it turns out that the order of the files in the .csproj file of the sample.ios.other project actually matters when using the latest Mono framework.

So lets say I have these files:

- ViewBase.cs (partial class ViewBase)
- ViewBaseIOS.cs (partial class ViewBase : UIViewController)
- DataViewBase.cs (partial class DataViewBase<TObject> : ViewBase)
- DataViewBaseIOS.cs (partial class DataViewBase)
- PageViewController.cs (class PageViewController : DataViewBase<string>)

In PageViewController i have the following override: public override void ViewDidLoad() {}

Now in the sample.ios.other cproj file the order of the linked files would be like this:

1) DataViewBaseIOS.cs
2) ViewBaseIOS.cs
3) PageViewController.cs
4) DataViewBase.cs
5) ViewBase.cs

Where there might be lots of files between those linked files, but the files should be in this order. 
Now when I compile the sample.ios.shared project against mono 2.10.12 the project compiles just fine. Now when I target against the mono 3.2.2 framework, the project won't compile. Because it says there is no suitable method to override the ViewDidLoad method.

Now I can fix this to change the order of the linked files in the sample.ios.shared project to something like this:

1) ViewBase.cs
2) ViewBaseIOS.cs
3) DataViewBase.cs
4) DataViewBaseIOS.cs
5) PageViewController.cs

The project will compile just fine. So apparently the order of the linked files does matter to the compiler when targeting mono 3.x.x and above.

I tried to create a sample solution to reproduce this issue, but it only seems to appear with larger projects.

Hope this is enough information to find and fix the issue.
Comment 1 Sebastien Pouliot 2013-09-16 15:12:41 UTC
Compiler issue
Comment 2 Marek Safar 2013-09-22 14:50:57 UTC
This is not easy to reproduce without test case. You can try to isolate it to from the original project or upload the project privately if that's possible
Comment 3 Matthijs Koopman 2013-09-22 14:53:14 UTC
I'm sorry i can't do that.

It's something that changed between the 2.10 an the 3.2 release, when targeting 2.10.x everything works great.
Comment 4 Vincent Dondain [MSFT] 2017-04-24 02:55:47 UTC
We have not received the requested information (test case). If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!