Bug 13400 - Portable Class Library
Summary: Portable Class Library
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2013-07-22 21:07 UTC by James Wilson
Modified: 2013-11-06 12:00 UTC (History)
6 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 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:
Status:
RESOLVED FIXED

Description James Wilson 2013-07-22 21:07:16 UTC
I originally posted this on stackoverflow.com

I am using Portable Class Libraries (PCL) in Xamarin Studio on OS X. I have two PCL libraries that are targeting .NET 4.5, Windows Phone 8, Windows Store Apps, Xamarin.iOS, and Xamarin.Android. I reference these two libraries in my iOS, Android, and Unit tests projects. In 3 areas I am getting the following error:

The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

The code is straightforward:

MyClass myClass = new MyClass();
The error occurs once in each of the projects that reference the PCLs. None of them are the same class. I am new to PCLs. I've tried removing the Windows Phone 8 (as I added it last minute) and yet the problem does not go away. Any help would be appeciated!

Thanks!

Update:

So this occurs with the first field declared in the class (where the class is from the PCL project).

int a = 0;
MyPCLClass _myPCLClass = new MyPCLClass();  //This is where the error appears
Another odd aspect is that there are over 50 classes using these classes, and the error is only appearing in three classes.

One person suggested I take the System.Runtime.dll from Windows (I took it from Windows 8) and add it to my Xamarin.iOS, Xamarin.Android, and NUnit test project.  This did get rid of the error, but then another error appeared for System.Collections.Generic in those projects.  It seems that the supported dlls aren't written out to these projects.  I'm still ver new to PCLs so I don't would put that as a guess.

Please let me know if there is anymore information I can provide.  Thanks!
Comment 1 Mikayla Hutchinson [MSFT] 2013-07-23 11:28:55 UTC
What version of Xamarin Studio?
Comment 2 James Wilson 2013-07-23 18:25:44 UTC
Hi Michael,

Xamarin Studio
Version 4.0.10 (build 5)
Installation UUID: ccd48b1a-c136-419e-a619-b97cb64636e2
Runtime:
	Mono 3.1.2 ((no/71af847)
	GTK 2.24.20
	GTK# (2.12.0.0)
	Package version: 301020000

Apple Developer Tools
Xcode 4.6.3 (2068)
Build 4H1503

Xamarin.Mac
Xamarin.Mac: Not Installed

Xamarin.Android
Version: 4.8.0 (Indie Edition)
Android SDK: /Users/james/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1 (API level 7)
		2.2 (API level 8)
		2.3 (API level 10)
		3.1 (API level 12)
		4.0 (API level 14)
Java SDK: /usr
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

Xamarin.iOS
Version: 6.3.8.11 (Indie Edition)
Hash: bc5a95b
Branch: 
Build date: 2013-17-07 15:48:27-0400

Build Information
Release ID: 400100005
Git revision: f78b1117e201b3890dce45559bc8995adc4005a2
Build date: 2013-07-15 16:16:13+0000
Xamarin addins: a158bb2e0120450d0d23a35a5d4cbc695947bcab

Operating System
Mac OS X 10.8.4
Darwin Jamess-MacBook-Pro.local 12.4.0 Darwin Kernel Version 12.4.0
    Wed May  1 17:57:12 PDT 2013
    root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64.


I downloaded it from the beta channel on Saturday.  Also, I forgot to attach the link to the original stackoverflow, but the above pretty much covers it.

http://stackoverflow.com/questions/17766014/portable-class-library-system-object-error/17778329?noredirect=1#17778329
Comment 3 René Ruppert 2013-10-14 14:30:00 UTC
I have just submitted https://bugzilla.xamarin.com/show_bug.cgi?id=15386 which looks very similar to your problem. Xamarin, please prioritize. We love PCLs!
Comment 4 Martin Baulig 2013-11-06 12:00:12 UTC
This has been fixed in the latest alpha version of our products.