Bug 26753 - Project compiles in Visual Studio but not in Xamarin Studio.
Summary: Project compiles in Visual Studio but not in Xamarin Studio.
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-02-04 15:38 UTC by Jon Goldberger [MSFT]
Modified: 2015-02-11 14:48 UTC (History)
2 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 Jon Goldberger [MSFT] 2015-02-04 15:38:03 UTC
## Description

Issue was reported by a customer who was using the nuget package Portable.Data.Sqlite. However I was able to recreate this issue using the samples provided on github in the Portable.Data.Sqlite repository. The issue is that though the iOS sample and the referenced Portable.Data.Sqlite library compile and run fine in Visual Studio, the same fails in Xamarin Studio. I checked with both Mono 3.16.0.68 and Mono 3.12.0.76. 


## Steps to reproduce

1. Download the Portable.Data.Sqlite repo from: https://github.com/ellisnet/Portable.Data.Sqlite and unzip
2. Open the Portable.Data.Sqlite solution from the root of the unzipped folder.
3. Build Portable.Data project.
4. Portable.Data.Sqlite projects.

Expected result: Portable.Data.Sqlite project will compile successfully as it does in Visual Studio.

Actual result: Project compile fails with the errors below:


> /Users/apple/Downloads/Portable.Data.Sqlite-master/Portable.Data.Sqlite/SQLiteConvert.cs(34,34): Error CS0584: Internal compiler error: Assembly 'System.Runtime.InteropServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is a missing assembly and does not support the requested operation. (CS0584) (Portable.Data.Sqlite)

> /Users/apple/Downloads/Portable.Data.Sqlite-master/Portable.Data.Sqlite/SQLiteConvert.cs(21,21): Error CS0584: Internal compiler error: Assembly 'System.Runtime.InteropServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is a missing assembly and does not support the requested operation. (CS0584) (Portable.Data.Sqlite)

> /Users/apple/Downloads/Portable.Data.Sqlite-master/Portable.Data.Sqlite/SQLiteConvert.cs(21,21): Error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement (CS0201) (Portable.Data.Sqlite)

> /Users/apple/Downloads/Portable.Data.Sqlite-master/Portable.Data.Sqlite/SQLiteConvert.cs(7,7): Error CS1684: Reference to type `System.IConvertible' claims it is defined assembly `mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found (CS1684) (Portable.Data.Sqlite)


## Build Output: https://gist.github.com/jgold6/9faf8784e696defab395

## Version info

=== Xamarin Studio ===

Version 5.7.1 (build 14)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 3.12.0 ((detached/de2f33f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.Mac ===

Version: 1.12.0.4 (Business Edition)

=== Xamarin.Android ===

Version: 4.20.0.28 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		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)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

=== Xamarin.iOS ===

Version: 8.6.1.20 (Business Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Build Information ===

Release ID: 507010014
Git revision: a4dd61ad7f8b3695be4b17bcb5c3ae6b81438cf7
Build date: 2015-01-19 15:21:09-05
Xamarin addins: 081208fe3bbf40e24a562867c6c7fba20a9b94b6

=== Operating System ===

Mac OS X 10.10.2
Darwin Jons-iMac.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 3 Marek Safar 2015-02-05 17:39:54 UTC
Internal compiler error is fixed in master.

The build now fails with

../Portable.Data.Sqlite/SQLiteConvert.cs(470,7): error CS1684: Reference to type `System.IConvertible' claims it is defined assembly `mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found
/Users/marek/git/bugs-repros/Portable.Data.Sqlite/Portable.Data/bin/Debug//Portable.Data.dll (Location of the symbol related to previous error)

which is probably little pedantic but correct as you are using DBNull which implement IConvertible but this PCL combination does not support IConvetible.

csc reports this as a warning but roslyn turned this into an error.
Comment 4 Jon Goldberger [MSFT] 2015-02-11 13:56:06 UTC
Thanks Marek.

What is odd is that it builds in Visual Studio with the DBNull inheriting from IConvertible, which I do see is not available in the Windows Store Apps target platform. So I looked again and for some reason when this solution is opened in Visual Studio, the PCL is not targeting Windows Store Apps, but when opened in Xamarin Studio it does. So that explains the difference. 

However I am unable to unselect Windows Store Apps in Xamarin Studio for this PCL project (likely a Xamarin Studio issue?). If I uncheck it, it is then implicitly selected and there is no change.
Comment 5 Jon Goldberger [MSFT] 2015-02-11 14:25:23 UTC
bug filed for issue noted in comment 4: https://bugzilla.xamarin.com/show_bug.cgi?id=26960
Comment 6 Marek Safar 2015-02-11 14:48:58 UTC
I didn't test this in VS but you could check from both build logs which PCL profile is used during build and it should be same in XS and VS otherwise it's XS (possibly xbuild) bug.