Bug 57284 - Adding System.Reactive to Android app fails with 'Multiple assemblies with equivalent identity have been imported'
Summary: Adding System.Reactive to Android app fails with 'Multiple assemblies with eq...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2017-06-08 18:29 UTC by James Moore
Modified: 2017-06-28 23:29 UTC (History)
2 users (show)

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:

Description James Moore 2017-06-08 18:29:04 UTC
Create a new Android application.  Add the System.Reactive nuget.  Build.

Build fails with:


/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: '/Users/james/Projects/TestRx/packages/System.Runtime.InteropServices.WindowsRuntime.4.0.1/lib/netstandard1.3/System.Runtime.InteropServices.WindowsRuntime.dll' and '/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.InteropServices.WindowsRuntime.dll'. Remove one of the duplicate references.
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.02

---------------------- Done ----------------------

Build: 1 error, 1 warning
Comment 1 James Moore 2017-06-08 18:29:23 UTC
=== Visual Studio Professional 2017 for Mac (Preview) ===

Version 7.1 Preview (7.1 build 583)
Installation UUID: 54529aae-a4b8-4338-92ef-3daa15673f67
	Mono (2017-04/4a0006f) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000104

=== NuGet ===


=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.0-preview2-003121/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.Android ===

Version: (Visual Studio Professional)
Android SDK: /Users/james/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		5.0 (API level 21)
		7.1 (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 26.0.0 rc2
SDK Build Tools Version: 26.0.0 rc2

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Android Designer EPL code available here:

=== Xamarin.iOS ===

Version: (Visual Studio Professional)
Hash: 7571635e
Branch: master
Build date: 2017-05-09 16:04:54-0400

=== Xamarin.Mac ===

Version: (Visual Studio Professional)

=== Xamarin Inspector ===

Version: 1.3.0-alpha2
Hash: fa030e0
Branch: master
Build date: Thu, 01 Jun 2017 20:55:26 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 701000583
Git revision: 445a7f09feca58babb966e0c66a6b299d0bd450c
Build date: 2017-05-12 16:05:38-04
Xamarin addins: f9b72ca5f6ca5d9476d8f58353ada2afd56c549b
Build lane: monodevelop-lion-d15-3-preview

=== Operating System ===

Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Macaque Tips 0.1.2
Comment 2 James Moore 2017-06-08 18:47:01 UTC
I shared a google doc with jonp@xamarin.com with the contents of the project, but there's nothing special there.  Just create a new android app and add the nuget.
Comment 3 Jonathan Pryor 2017-06-08 20:23:01 UTC
I see why your repro is so big: you're presumably including the `packages` directory, all 300+MB of it.

For future reference, it is *not* necessary to include the `packages` directory in repros. `nuget restore` will restore them on-demand.
Comment 4 Marek Safar 2017-06-12 15:43:22 UTC
The error is expected because System.Runtime.InteropServices.WindowsRuntime v4.0.1 does not support Xamarin products. You need to use v4.3.0 or newer.

The dependency seems to come from https://www.nuget.org/packages/System.Reactive.Linq/
Comment 5 James Moore 2017-06-27 21:11:20 UTC
So someone at Microsoft/Xamarin needs to go talk to people in the Microsoft/Rx team and make sure the Rx team knows they can't ship stuff that breaks Xamarin, and that their tests have to include Xamarin.  This bug shouldn't be closed.
Comment 6 James Moore 2017-06-27 22:21:38 UTC
Added sample project to https://github.com/banshee/rxBugReportSampleCode
Comment 7 Jon Douglas [MSFT] 2017-06-27 22:23:29 UTC
As per https://bugzilla.xamarin.com/show_bug.cgi?id=57284#c4 there is also a known issue of this in the RX repo:


A workaround was also posted in https://bugzilla.xamarin.com/show_bug.cgi?id=43494#c5

So ideally, The following dependencies needs to be updated to have a dependency on System.Runtime.InteropServices.WindowsRuntime 4.3.0 or higher.

https://www.nuget.org/packages/System.Reactive.Linq (Probably the only one that matters in this case if you aren't using RxUI)



Comment 8 James Moore 2017-06-28 23:29:14 UTC
I filed https://bugzilla.xamarin.com/show_bug.cgi?id=57849, since I think it's related but not affected by just forcing System.Runtime.InteropServices.WindowsRuntime to 4.3.0.