Xamarin-macios: Latest xamarin.ios and vs4mac cause build trouble

Created on 16 Nov 2018  路  8Comments  路  Source: xamarin/xamarin-macios

no such problem for previous xamarin.ios sdk and vs4mac

MTOUCH : error MT2002: Failed to resolve "System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder" reference from "System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"

VS mac :
Xamarin.iOS
Version: 12.2.1.10 (Visual Studio Community)
Hash: f2a05edd
Branch: d15-9
Build date: 2018-10-31 18:55:57-0400

bug iOS

All 8 comments

Hello, thank you for your feedback!

For us to investigate this further, could you please provide your full build logs, crash reports (if any), test case (to reproduce) and all your full version information.

To get full build logs just set the log verbosity to diagnostic at the following locations:

  • On Visual Studio for Mac: Preferences > Projects > Build
  • On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

    On Visual Studio for Windows you also want to add -v -v -v -v to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting Properties.

    Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

    The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.

  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

    Then copy/paste the version information (you can use the "Copy Information" button).

    We look forward to hearing from you!

@juepiezhongren same error as you, this is most likely caused by the package Microsoft.AspNetCore.SignalR.Client that relies on System.Threading.Tasks.Extensions, there are two workarounds that can temporarily solve the build problem:

  1. Removing _Microsoft.AspNetCore.SignalR.Client_ from your project if this package is not required
  2. Rolling back to the previous mono version means you need to lower your Xamarin.iOS version. For example 12.1.0.5. You can download it from here

@Wenfengcheng yes, i guess u r write, we do use signalr core, thx!
澶х锛岀粰涓猶q鍙峰惂锛屾垜鐨勬槸261533144

While checking whether this error also affects Xamarin.Android, I noticed that it is possible to stop the build error by moving the facade assembly away from its install location:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Threading.Tasks.Extensions.dll

That said, I suspect this might not be a complete workaround because apps might then hit a related error at run time: https://github.com/xamarin/xamarin-macios/issues/5133.

Steps to Reproduce

Attempt to build the attached project in the "Debug|iPhoneSimulator" configuration in Visual Studio on Windows.

Expected Behavior

The project builds without error.

Actual Behavior

The build fails with an error and a warning:

error MT2002: Failed to resolve "System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder" reference from "System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"

warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.

In contrast, building directly on macOS succeeds but produces two warnings:

warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.

MTOUCH : warning MT0109: The assembly 'System.Threading.Tasks.Extensions.dll' was loaded from a different path than the provided path (provided path: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades/System.Threading.Tasks.Extensions.dll, actual path: /Users/macuser/src/SignalRTaskExtensions/packages/System.Threading.Tasks.Extensions.4.5.0/lib/netstandard2.0/System.Threading.Tasks.Extensions.dll).

Environment

Windows 10

Visual Studio 2017 version 15.9

macOS 10.13

Mono Framework MDK version 5.12.0.309 (2018-02/39d89a335c8)
Microsoft (R) Build Engine version 15.7.224.30163 (xplat-master/d375bb6e Thu Sep 27 07:16:13 EDT 2018)

Build Logs

DiagnosticBuildOutput.zip

Example Project (If Possible)

TestCase5135.zip

This issue was moved to mono/mono#11731

A good test to start is to verify if the Link is enabled.

Choose "Don't Link" and try to rebuild your app. ;)

Hello, the mono team has fixed the issue and we have some build candidates here
https://github.com/xamarin/xamarin-macios/issues/5158#issuecomment-440673490 please let us know if these fixes your issue. Report back to https://github.com/xamarin/xamarin-macios/issues/5158.

Thanks!

@juepiezhongren same error as you, works fine after downgrade to xamarin.ios-12.1.0.15

Was this page helpful?
0 / 5 - 0 ratings