Bug 18919 - Problem with default assemblies and PCL
Summary: Problem with default assemblies and PCL
Status: RESOLVED FEATURE
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-04-09 22:39 UTC by Miguel de Icaza [MSFT]
Modified: 2014-04-10 05:14 UTC (History)
1 user (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 FEATURE

Description Miguel de Icaza [MSFT] 2014-04-09 22:39:16 UTC
I was trying to build Google's APIs:

http://t.co/n9AEf0gXKW

This package poses a few problems:

(a) Needs NuGet, because it brings a number of external libraries
(b) Defaults to a PCL profile that we do not support

So you need to use our upcoming Xamarin Studio with NuGet support to work around (a), a package is available here:

https://wrench.internalx.com/Wrench/ViewLane.aspx?lane_id=688&host_id=95&revision_id=290930#

Then you must reset the GoogleApi.Core Portable Profile to include #78 instead of the default, and do the same for GoogleAPIs.

When you build, the result is that the compiler claims:

error CS0518: The predefined type `System.Object' is defined in an assembly that is not referenced.

Full log:
https://gist.github.com/anonymous/0dd21b2219d789869e07

This is probably caused because the PCLs download a System.Runtime.dll:

/reference:../../packages/Microsoft.Bcl.1.0.19/lib/portable-net40+sl4+win8+wp71/System.Runtime.dll

That one seems to just contain a few types that "augment" System.Runtime.dll from the system:

monodis --typedef ../../packages/Microsoft.Bcl.1.0.19/lib/portable-net40+sl4+win8+wp71/System.Runtime.dll
Typedef Table
1: (null) (flist=1, mlist=1, flags=0x0, extends=0x0)
2: System.Strings (flist=1, mlist=1, flags=0x100000, extends=0x5)
3: System.Collections.IStructuralEquatable (flist=3, mlist=7, flags=0xa1, extends=0x0)
4: System.Collections.IStructuralComparable (flist=3, mlist=9, flags=0xa1, extends=0x0)
5: System.Func`6 (flist=3, mlist=10, flags=0x101, extends=0x9)
6: System.IProgress`1 (flist=3, mlist=14, flags=0xa1, extends=0x0)
7: System.Runtime.CompilerServices.StateMachineAttribute (flist=3, mlist=15, flags=0x100001, extends=0xd)
8: System.Runtime.CompilerServices.AsyncStateMachineAttribute (flist=4, mlist=18, flags=0x100101, extends=0x1c)
9: System.Runtime.CompilerServices.CallerMemberNameAttribute (flist=4, mlist=19, flags=0x100101, extends=0xd)
10: System.Runtime.CompilerServices.CallerLineNumberAttribute (flist=4, mlist=20, flags=0x100101, extends=0xd)
11: System.Runtime.CompilerServices.CallerFilePathAttribute (flist=4, mlist=21, flags=0x100101, extends=0xd)
12: System.Runtime.CompilerServices.IteratorStateMachineAttribute (flist=4, mlist=22, flags=0x100101, extends=0x1c)
13: System.ITuple (flist=4, mlist=23, flags=0xa0, extends=0x0)
14: System.Tuple (flist=4, mlist=26, flags=0x100181, extends=0x5)
15: System.Tuple`1 (flist=4, mlist=41, flags=0x100001, extends=0x5)
16: System.Tuple`2 (flist=5, mlist=53, flags=0x100001, extends=0x5)
17: System.Tuple`3 (flist=7, mlist=66, flags=0x100001, extends=0x5)
18: System.Tuple`4 (flist=10, mlist=80, flags=0x100001, extends=0x5)
19: System.Tuple`5 (flist=14, mlist=95, flags=0x100001, extends=0x5)
20: System.Tuple`6 (flist=19, mlist=111, flags=0x100001, extends=0x5)
21: System.Tuple`7 (flist=25, mlist=128, flags=0x100001, extends=0x5)
22: System.Tuple`8 (flist=32, mlist=146, flags=0x100001, extends=0x5)
23: System.Reflection.AssemblyMetadataAttribute (flist=40, mlist=165, flags=0x100000, extends=0xd)

And nothing else.

If I move this:

 /reference:/Library/Frameworks/Mono.framework/Versions/3.4.1/lib/mono/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile78/System.Runtime.dll 

To the beginning of the compilation, instead of getting errors about System.Object (and another 33 or so errors) not being declared I get a much shorter list:

Apis/Http/ConfigurableHttpClient.cs(25,43): error CS0012: The type `System.IDisposable' is defined in an assembly that is not referenced. Consider adding a reference to assembly `mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
/private/tmp/Google/Src/GoogleApis.Core/../../packages/Microsoft.Net.Http.2.1.10/lib/portable-net40+sl4+win8+wp71/System.Net.Http.dll (Location of the symbol related to previous error)
Apis/Json/NewtonsoftJsonSerializer.cs(30,45): error CS0012: The type `System.Object' is defined in an assembly that is not referenced. Consider adding a reference to assembly `mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
/private/tmp/Google/Src/GoogleApis.Core/../../packages/Newtonsoft.Json.5.0.8/lib/portable-net40+sl4+wp7+win8/Newtonsoft.Json.dll (Location of the symbol related to previous error)
Apis/Http/IHttpUnsuccessfulResponseHandler.cs(63,9): error CS0012: The type `System.IAsyncResult' is defined in an assembly that is not referenced. Consider adding a reference to assembly `mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
/private/tmp/Google/Src/GoogleApis.Core/../../packages/Microsoft.Bcl.1.0.19/lib/portable-net40+sl4+win8+wp71/System.Threading.Tasks.dll (Location of the symbol related to previous error)
Apis/Http/BackOffHandler.cs(157,13): error CS0012: The type `System.ValueType' is defined in an assembly that is not referenced. Consider adding a reference to assembly `mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
/private/tmp/Google/Src/GoogleApis.Core/../../packages/Microsoft.Bcl.1.0.19/lib/portable-net40+sl4+win8+wp71/System.Threading.Tasks.dll (Location of the symbol related to previous error)
Apis/Json/NewtonsoftJsonSerializer.cs(37,32): error CS0115: `Google.Apis.Json.RFC3339DateTimeConverter.ReadJson(Newtonsoft.Json.JsonReader, System.Type, object, Newtonsoft.Json.JsonSerializer)' is marked as an override but no suitable method found to override
Apis/Json/NewtonsoftJsonSerializer.cs(43,30): error CS0115: `Google.Apis.Json.RFC3339DateTimeConverter.CanConvert(System.Type)' is marked as an override but no suitable method found to override
Compilation failed: 6 error(s), 0 warnings

This seems like the compiler is not iterating over all the referenced assemblies to find a match
Comment 1 Marek Safar 2014-04-10 05:14:13 UTC
The project references are wrong they have duplicate System.Runtime.dll

I improved the error message though.