Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 4181 [details]
Small project demonstrating the problem.
MonoDevelop automatically adds System.Core.dll as a reference when calling the compiler, even for projects with "Target framework" configured to "Mono / .NET 2.0". This reference is not listed in the project inside MonoDevelop, so it can't be removed manually. The command line looks something like this:
/usr/bin/mcs /noconfig "/r:/usr/lib/mono/2.0/mscorlib.dll" -nostdlib "/out:/home/michael/Test/Project/bin/Debug/Project.exe" "/r:/usr/lib/mono/2.0/System.dll" "/r:/usr/lib/mono/2.0/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 /platform:x86 "/define:DEBUG" /t:exe "/home/michael/Test/Project/Program.cs"
In certain cases (for example when using a System.Linq reimplementation for .NET 2.0) this can lead to errors as for example this one:
"Error CS0121: The call is ambiguous between the following methods or properties: `System.Linq.Enumerable.Count<int>(this System.Collections.Generic.IEnumerable<int>)' and `System.Linq.Enumerable.Count<int>(this System.Collections.Generic.IEnumerable<int>)' (CS0121) (Project)"
Removing "/r:/usr/lib/mono/2.0/System.Core.dll" from the command and invoking the compiler directly from the command line allows the program to compile (and run) just fine.
As far as I know the System.Core.dll did not exist prior to .NET 3.5, so I am not sure why it can be referenced. And in any case the reference should not be forced by MonoDevelop.
Fixed in master.