Bug 13464 - Error when referencing dependency which depends on System.Core
Summary: Error when referencing dependency which depends on System.Core
Status: RESOLVED FEATURE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
: 13513 ()
Depends on:
Blocks:
 
Reported: 2013-07-25 05:09 UTC by Adam
Modified: 2013-08-05 12:46 UTC (History)
7 users (show)

Tags:
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:
Status:
RESOLVED FEATURE

Description Adam 2013-07-25 05:09:49 UTC
This was working, then I updated to Xamarin 4.10, now I get

Error CS0012: The type `System.Func`3<TinyIoC.TinyIoCContainer,TinyIoC.NamedParameterOverloads,RegisterType>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' (CS0012)

My project no longer compiles.

It seems every time I update Xamarin, I lose at least a day to trying to fix breakages.
Comment 1 George Danila 2013-07-25 05:35:35 UTC
I'm experiencing a similar issue after updating to Xamarin 4.0.10

I have a reference to an assembly that references System.Xml

When trying to build my application I get the following error:

Error CS0012: The type `System.Xml.Serialization.IXmlSerializable' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' (CS0012)
Comment 2 Marek Safar 2013-07-25 09:28:34 UTC
The error message is correct (unless you already have the reference in your project). Just follow what the compiler says and the project should compile without error.
Comment 3 Adam 2013-07-25 22:50:03 UTC
Just to clarify - I already have a reference to System.Core in my project, its a reference to Xamarin's System.Core version 2.0.5.0.
Should I be removing the Xamarin version and adding one to a Mono desktop one? Where am I supposed to get this "System.Core 3.5.0.0"?

Why was this working just fine for the last month, and now no longer works after updating XS?

Either something was wrong before, or something is wrong now...
Comment 4 George Danila 2013-07-26 03:01:28 UTC
Some clarification from my part too - I have a .NET class library that references System.XML.dll from the .NET framework. This project is then referenced in a Xamarin.iOS project.

I managed to fix the compilation error by removing the reference to the Mono System.XML.dll (on my Xamarin.iOS project) and referencing the System.XML.dll from the .NET Framework Client profile I copied over from a Windows machine.

Still, this is a very weird error since everything worked seamlessly before the 4.0.10 Xamarin Studio update.

Hope this information proves helpful.
Comment 5 Marek Safar 2013-07-26 05:26:32 UTC
In both cases you are using assemblies which have full .net framework references not the one from Xamarin.iOS

System.Core, Version=3.5.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089
vs
System.Core, Version=2.0.5.0, Culture=neutral,PublicKeyToken=7cec85d7bea7798e


System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
vs
System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e

Note public key token difference.

You can either add both references to your project (quite weird) or recompile your reference to use Xamarin.iOS assembly instead of .NET assembly.
Comment 6 Adam 2013-07-26 05:33:23 UTC
Thanks for the info - 

Why did this work before updating XS?
Comment 7 Marek Safar 2013-07-26 05:41:51 UTC
The check was not done in Mono 2.10 compiler which older version of Xamarin.iOS used but it's included in Mono 3.2 compiler and it's now consistent with Xamarin.Android.

The KB page for Xamarin.Android which now applied to Xamarin.iOS too is 

http://support.xamarin.com/customer/portal/articles/142100-can-i-use-standard-desktop-mono-assemblies-or-net-assemblies-with-mono-for-android
Comment 8 Marek Safar 2013-07-26 16:58:08 UTC
*** Bug 13513 has been marked as a duplicate of this bug. ***
Comment 9 danmiser 2013-07-26 20:26:37 UTC
I'm facing the same problem. Looks like my problem is the ServiceStack dlls. I want to recompile them so they work, but everything in my Edit References looks good. The project is an assembly with Mono/.NET 3.5. The references that ServiceStack.Common uses are all listed as "mono" in the Package column, but have different versions like System 2.0.0.0 and System.Core 3.5.0.0. How do I:

a) Know what the offending assemblies are?
b) Update the reference to the good one?
Comment 10 danmiser 2013-07-27 14:46:50 UTC
I think I have it now, thanks to Brendan in support.

The problem IS that the assembly is a Mono/.NET 3.5 assembly. I had to go to all of my referenced assemblies and turn them in to an iOS project. The way I went about doing that was to edit the csproj and add/replace the ProjectTypeGuid element to look like this (based on what a brand new iOS csproj looked like at the time I did this):

<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

After rebuilding all of my referenced assemblies with this, the project now compiles correctly.
Comment 11 Adam 2013-07-28 00:01:47 UTC
Ooh feature request!!!!

Context menu on Project node "Convert to iOS Project"