Bug 23919 - Projects with PCL Profile 7 (Possibly others) can not be built with Link All Assemblies with Xamarin 4.99 (Alpha channel 10/18/2014)
Summary: Projects with PCL Profile 7 (Possibly others) can not be built with Link All ...
Status: RESOLVED DUPLICATE of bug 23617
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 4.18.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-10-18 14:11 UTC by T.J. Purtell
Modified: 2014-11-03 22:40 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description T.J. Purtell 2014-10-18 14:11:42 UTC
If you include a PCL profile 7 (maybe others) DLL in a Xamarin.Android project and call a method from that DLL, then Xamarin fails to link the project in Link All Assemblies mode.  

This is the error that occurs
> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task GenerateJavaStubs: Could not load assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
: error : Error building target _GenerateJavaStubs: Object reference not set to an instance of an object


I have created a sample project illustrating this issue: https://bitbucket.org/tpurtell/xamarin-4.99-pcl-link-failure
Comment 1 Ram Chandra 2014-10-20 09:50:35 UTC
I have checked this issue but I am unable to reproduce this issue.

Steps I followed:

1. Create an PCL project in XS.
2. Write the following method in MyClass.cs file
  
       public string Foo()
        {
           return "This is PCL project";
        }

3.  Choose current profile (right click on PCL project => Options => General => select current profile "PCL 4.5 - Profile 7".

4. Press Ok button to save the settings.
5. Build the PCL project.
6. Add an android application to the current solution.
7. Add the PCL reference to the android project.
8. Set the link behavior "Link to all assembly" (right click on android project => Android Build => Click on Linker tab => select the "Link all assembly" option for "Link Behavior".
9. Write the following method in button click event of "MainActivity.cs" file.
         
           MyClass objMyClass=new MyClass();
           string strResult= objMyClass.Foo();
           Console.WriteLine (strResult);

10. Build and deploy the android project.
11. Press the "Hello World, Click Me !" button.


I am able to build and deploy the android application with any error also I am able to call PCL methods from my android project.
I have checked the same with attached sample and attached application is working fine without any error.

Screencast: http://www.screencast.com/t/T8KCVXd1PYTT

Could you please attached build output and build details? So that we can reproduce this issue at our end.

You can get build output from here:

View => Pad => Errors => Copy the build output (attached the full build output with your comment)

You can get build details from here:

Xamarin Studio => About Xamarin Studio => Show Details => Copy Information.

Environment Info:

=== Xamarin Studio ===

Version 5.5.2 (build 3)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.Mac ===

Version: 1.9.0.530 (Business Edition)

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.0   (API level 11)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.iOS ===

Version: 8.2.0.207 (Business Edition)
Hash: 3bf072d
Branch: 
Build date: 2014-10-15 21:44:26-0400

=== Build Information ===

Release ID: 505020003
Git revision: 6d4c806e383ba366b15fbccca9ddc1ba94f8d5ad
Build date: 2014-10-15 15:00:36-04
Xamarin addins: 069ddd29bb70a42238142eee9bac21a5e4b2f9f9

=== Operating System ===

Mac OS X 10.9.5
Darwin Jatin66s-iMac.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 T.J. Purtell 2014-10-20 10:42:05 UTC
As noted in the bug title this issue occurs with the 4.99 xamarin that is in the alpha channel on mac "Xamarin 4.99 (Alpha channel 10/18/2014)".

== VERSION DETAILS ==

Xamarin Studio

Version 5.6.1 (build 5)

Installation UUID: aa9e1846-062e-4288-9585-51950c1d3cec

Runtime:

               Mono 3.10.0 ((detached/633e444)

               GTK+ 2.24.23 (Raleigh theme)

 

               Package version: 310000020

 

Apple Developer Tools

Xcode 5.1.1 (5085)

Build 5B1008

 

Xamarin.iOS

Version: 8.2.0.193 (Enterprise Edition)

Hash: 959c1e4

Branch: 

Build date: 2014-10-03 00:25:37-0400

 

Xamarin.Android

Version: 4.99.0 (Enterprise Edition)

Android SDK: /Users/tj/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)

                              4.0.3 (API level 15)

                              4.1   (API level 16)

                              4.2   (API level 17)

                              4.3   (API level 18)

                              4.4   (API level 19)

Java SDK: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

java version "1.6.0_65"

Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)

Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

 

Xamarin.Mac

Version:

 

Build Information

Release ID: 506010005

Git revision: 4a603dc77610b9eff2a41582146c56b69a81ceba

Build date: 2014-10-09 11:07:06-04

 

Operating System

Mac OS X 10.9.5

Darwin lucite.private 13.4.0 Darwin Kernel Version 13.4.0

    Sun Aug 17 19:50:11 PDT 2014

    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 3 narayanp 2014-11-03 06:33:59 UTC
I have tried to reproduce this issue and getting the same behavior. I followed steps mentioned in comment 1 to reproduce this issue.

Screencast: http://www.screencast.com/t/p7fr2H0DpxFd
Application output:  https://gist.github.com/sunil360/2a2903bd19eda95620f2

Environment info:
=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: 561c7a69-0a91-4bae-ad7c-f0c79d594337
Runtime:
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

=== Xamarin.Android ===

Version: 4.99.0 (Trial Edition)
Android SDK: /Users/tajinder/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.4.0.16 (Trial Edition)
Hash: 80e9ff7
Branch: 
Build date: 2014-10-22 15:09:12-0400

=== Xamarin.Mac ===

Version: 1.10.0.18 (Starter Edition)

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.8.4
Darwin Tajinders-iMac.local 12.4.2 Darwin Kernel Version 12.4.2
    Mon Jun 17 18:00:12 PDT 2013
    root:xnu-2050.45.8~1/RELEASE_X86_64 x86_64
Comment 4 Jonathan Pryor 2014-11-03 22:40:44 UTC
I suspect that this is a DUPE of Bug #23617.

Please re-test against monodroid/840487dd (XA 4.99.0-167) or later.

*** This bug has been marked as a duplicate of bug 23617 ***

Note You need to log in before you can comment on or make changes to this bug.