Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin.iOS project fails to build after update to System.Reactive 4.1.0.0 #4629

Closed
DaRosenberg opened this Issue Aug 16, 2018 · 14 comments

Comments

Projects
None yet
9 participants
@DaRosenberg
Copy link

DaRosenberg commented Aug 16, 2018

Steps to Reproduce

  1. Open solution
  2. Add an iOS project
  3. Add a .NET Standard 2.0 class library, and reference this from the iOS project
  4. Add System.Reactive 4.1.0.0 as a package reference to the class library
  5. Ensure Mac is connected
  6. Build solution

Expected Behavior

Build should complete successfully. This is the case when referencing System.Reactive 4.0.0.0.

Actual Behavior

Build fails with error message:

error MT2001: Could not link assemblies. Reason: Error while processing references of 'IDeliverable.Retrospect.Xamarin.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

Environment

Visual Studio

Microsoft Visual Studio Professional 2017 
Version 15.8.0
VisualStudio.15.Release/15.8.0+28010.0
Microsoft .NET Framework
Version 4.7.03062

Installed Version: Professional

Microsoft Visual Studio Tools for Applications 2017   00369-60000-00001-AA744
Microsoft Visual Studio Tools for Applications 2017

Visual C++ 2017   00369-60000-00001-AA744
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package   8.13.10627.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.8.05067.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   15.8.31590
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017   5.2.60618.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.8.05023.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.3.3000.5
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   15.8.05023.0
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.3.3000.5
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   2.9.0-beta8-63208-01
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.5.4.3349
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Merq   1.1.38 (5b3c069)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure HDInsight Azure Node   2.3.3000.5
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.3.3000.5
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   2.3
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.3.3000.5
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10730.2

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   1.0
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

MLGen Package Extension   1.0
MLGen Package Visual Studio Extension Detailed Info

Mono Debugging for Visual Studio   4.11.7-pre (8955b2a)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.4.20802.1 Commit Hash:97e1085d8b4b8e3e51c398e910177f87e86d135e
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools   15.1.61808.07020
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   15.8.20801.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   2.9.0-beta8-63208-01
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.2 for F# 4.5   15.8.0.0.  Commit Hash: c55dd2c3d618eb93a8d16e503947342b1fa93556.
Microsoft Visual F# Tools 10.2 for F# 4.5

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Universal Windows Apps   15.0.28010.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   4.11.0.732 (d15-8@33e83e124)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.14.218 (79f535bdd)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   1.1.113 (e1d02a7)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   9.0.0.18 (HEAD/3d8a28f1a)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   11.14.0.13 (373c313)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Visual Studio for Mac

Please note: The issue was the same with the latest from the Stable channel. I only switch to the Beta channel to see if it would fix the issue, but it's exactly the same.

=== Visual Studio Professional 2017 for Mac (Preview) ===

Version 7.6 Preview (7.6 build 2086)
Installation UUID: 18b1cf61-9d12-4056-852a-6a64a98fb8d6
Runtime:
	Mono 5.12.0.298 (2018-02/f795aa5d2db) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

	Package version: 512000298

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.1.1
	2.0.5
	2.0.0
	1.1.1
	1.0.4
SDK: /usr/local/share/dotnet/sdk/2.1.301/Sdks
SDK Versions:
	2.1.301
	2.1.4
	2.0.0
	1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

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

=== Apple Developer Tools ===

Xcode 9.4.1 (14161)
Build 9F2000

=== Xamarin.Mac ===

Version: 4.6.0.11 (Visual Studio Professional)
Hash: 61d20a80
Branch: 
Build date: 2018-07-09 14:24:45-0400

=== Xamarin.iOS ===

Version: 11.14.0.11 (Visual Studio Professional)
Hash: 61d20a80
Branch: HEAD
Build date: 2018-07-09 14:24:45-0400

=== Xamarin.Android ===

Version: 9.0.0.17 (Visual Studio Professional)
Android SDK: /Users/danielstolt/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 706002086
Git revision: 8499c223e73efdb42f7b5dd7cd53d3477cc31d24
Build date: 2018-07-19 20:45:05+00
Build branch: release-7.6
Xamarin extensions: 4fb0029af6cee260ffb56279b7b17ca51cd4ca18

=== Operating System ===

Mac OS X 10.13.3
Darwin 17.4.0 Darwin Kernel Version 17.4.0
    Sun Dec 17 09:19:54 PST 2017
    root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

Internet of Things (IoT) development (Preview) 7.5

Build Logs

Diagnostic build log can be found here:

https://gist.github.com/DaRosenberg/d5c1c2c4afdfd1635f922df8c7bbb6db

Example Project (If Possible)

Not possible unfortunately.

@DaRosenberg

This comment has been minimized.

Copy link
Author

DaRosenberg commented Aug 16, 2018

BTW, I should mention:

  • The same error happens both on Visual Studio and Visual Studio for Mac.
  • The same error happens whether I build for simulator or device.
  • Linker behavior is set to "Don't Link".

@DaRosenberg DaRosenberg changed the title Xamarin.iOS project fails to build after upgrade to 15.8 Xamarin.iOS project fails to build after update to System.Reactive 4.1.0.0 Aug 16, 2018

@DaRosenberg

This comment has been minimized.

Copy link
Author

DaRosenberg commented Aug 16, 2018

This turned out to not be related only to the 15.8 upgrade, but also to a change in our code (update package references to System.Reactive from 4.0.0.0 to 4.1.0.0. I've updated title and description to reflect this. We're still curious as to why Xamarin.iOS chokes on it, however.

@spouliot

This comment has been minimized.

Copy link
Contributor

spouliot commented Aug 16, 2018

Thanks for the detailed build, sadly it did not augment verbosity to what mtouch was doing. Can you add -v -v -v -v to the Additional mtouch arguments in your project options ?

From the error it appears that an (deep) exception occurs when processing the IDeliverable.Retrospect.Xamarin.iOS assembly. Without more verbosity the inner exception is not shown.

This is often because something is wrong with an assembly reference but, normally, there would be a better error message than the generic 2001.

My guess since you're updating a package is that there's a missing/required reference in your build, i.e. something 4.1 requires that was not present in 4.0 (even if such condition are generally better reported elsewhere).

@DaRosenberg

This comment has been minimized.

Copy link
Author

DaRosenberg commented Aug 16, 2018

Thanks @spouliot! I added the -v -v -v -v as you requested, and the build output now contains a more specific clue:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(793,3): error MT2001: Could not link assemblies. Reason: Error while processing references of 'IDeliverable.Retrospect.Xamarin.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
1>  --- inner exception
1>  Mono.Linker.LoadException: Error while processing references of 'IDeliverable.Retrospect.Xamarin.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'IDeliverable.Retrospect.Core, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
...
1>Build FAILED.

Here's the gist of it.

https://gist.github.com/DaRosenberg/3991371d4a1e5e80ef5e236f4bf2e0bc

I tried manually adding a reference to the System.Threading.Tasks.Extensions package to both the iOS project, and to the dependent projects, but it doesn't change the outcome.

@spouliot

This comment has been minimized.

Copy link
Contributor

spouliot commented Aug 16, 2018

Thanks for quickly providing the details :)

Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

This is not one of the .net facades that ships with the XI SDK.

Have you tried using the nuget with the same version ? it's not clear if your update log has it (or not)

Normally you should see it inside the assemblies given to mtouch
https://gist.github.com/DaRosenberg/3991371d4a1e5e80ef5e236f4bf2e0bc#file-build-log-L865
so the assembly resolver knows where to find this (non SDK) assembly when requested to load it.

You could add -r=/path/to/the/assembly/on/the/Mac/System.Threading.Tasks.Extensions.dll (to confirm it works) but that should not be required (something else is incorrect) and not a good, future proof solution.

@rdavisau

This comment has been minimized.

Copy link

rdavisau commented Aug 19, 2018

I tried the same thing as @DaRosenberg and encountered the same error. One thing to note is that System.Threading.Tasks.Extensions, Version=4.2.0.0 lives in the NuGet version 4.5.1.

I took a closer look at my iOS project and saw that although packages.config included the NuGet for System.Threading.Tasks.Extensions, the .csproj was missing a reference. After adding, I was able to build successfully.

    <Reference Include="System.Threading.Tasks.Extensions">
      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
    </Reference>

@mandel-macaque mandel-macaque added this to the Future milestone Aug 20, 2018

@DaRosenberg

This comment has been minimized.

Copy link
Author

DaRosenberg commented Aug 20, 2018

@rdavisau OK, that's a good clue. Our iOS project is not using packages.config anymore (we migrated to the new .csproj based package reference system a while back) so adding that assembly reference manually is not an option for us, unfortunately.

@DaRosenberg

This comment has been minimized.

Copy link
Author

DaRosenberg commented Aug 20, 2018

@spouliot OK so I did some checking based on what you wrote.

I'm not clear on what the story is with these "facades" and "type forwardings" and related terms that I frequently hear around Xamarin discussions. As an aside, could you clarify how this works or point to some form of documentation to help understand these concepts?

I can see that the file System.Threading.Tasks.Extensions.dll is not even present in the build directory on the Mac, despite two of my class libraries (targeting netstandard2.0) are referencing that package.

Looking inside that package in the .nuget package cache, it contains a lib/xamarinios10 folder that only contains an empty file named _._. I suspect this is somehow the reason why the DLL file itself is not copied? Is this what makes the build process assume that there is a "facade"?

Earlier versions of the System.Threading.Tasks.Extensions package (version 4.5.0 and below) do not contain any lib/xamarinios10 folder. This seems to have been added in 4.5.1.

@spouliot

This comment has been minimized.

Copy link
Contributor

spouliot commented Aug 20, 2018

@DaRosenberg I'm not expert myself but I think you found the issue.

dotnet/corefx@19426a7#diff-89439631f47fbbd449e2d44f08857575

AFAIK this (and/or previous commits) added instruction that nothing is required from Xamarin.iOS (and other Xamarin SDK) to support STTE.dll - which is not correct since this is not something we ship (thru Mono).

c.c. @tarekgh

@tarekgh

This comment has been minimized.

Copy link

tarekgh commented Aug 20, 2018

We have added a placeholder for System.Threading.Tasks.Extensions package for Xamarin platform dotnet/corefx#29585 as Xamarin should have their own inbox version that needs to be used.

@akoeplinger @marek-safar can talk more about that.

CC @weshaggard @joperezr

@marek-safar

This comment has been minimized.

Copy link
Contributor

marek-safar commented Aug 30, 2018

Yeah, we are tracking the issue on our side as mono/mono#10142

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Sep 7, 2018

Closing since this is tracked in mono/mono (see previous comment).

@AshishSharma788

This comment has been minimized.

Copy link

AshishSharma788 commented Nov 28, 2018

How i'm add this in my project ?
Thanks for the detailed build, sadly it did not augment verbosity to what mtouch was doing. Can you add -v -v -v -v to the Additional mtouch arguments in your project options ?

@xperiandri

This comment has been minimized.

Copy link

xperiandri commented Feb 20, 2019

@rdavisau thanks. It woks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.