0

I created that simple xamarin forms app (with just iOS). It does nothing but referencing that signalr nuget package.

When I build Debug | iPhone from Visual Studio on my pc (connected to my mac), it builds fine and especially does AOT compilation for Microsoft.AspNetCore.Sockets.Abstractions.dll (as well as all other dlls).

However, when I build the same solution on Visual Studio for Mac, also on Debug | iPhone, I get the following error:

Could not AOT the assembly '/Users/francois/AotTests/AotTests/AotTests.iOS/obj/iPhone/Debug/mtouch-cache/Build/Microsoft.AspNetCore.Sockets.Abstractions.dll' (MT3001) (AotTests.iOS)}

François
  • 3,164
  • 25
  • 58
  • Try to change to `Link All` with Linker Behavior in iOS build ,and uncheck `Enable incremental builds` – ColeX Apr 05 '18 at 09:14
  • Same error with `Link All` and `Enable incremental builds` unchecked. – François Apr 05 '18 at 09:27
  • MT3001 errors can happen for many reasons (and only means the AOT compiler has not produce any output). As such stackoverflow is not the best place for them (most cases are unrelated). Please file an issue with Xamarin https://github.com/xamarin/xamarin-macios/issues/new Thanks! – poupou Apr 06 '18 at 18:43

1 Answers1

3

Bonjour,

TL;DR

This has been fixed in https://github.com/xamarin/xamarin-macios/pull/3791 and we are trying to get it in our next stable release (aka 15.7).

You can try the fix with our continuous builds here: https://github.com/xamarin/xamarin-macios/wiki#continuous-builds.
In this case you want builds from master (hopefully soon from our 15.7 previous currently in alpha/beta).


What happened?

The NuGet package you added (Microsoft.AspNetCore.SignalR.Client) was added via a new "package reference" mechanism and had dependencies (other packages) that had both /lib and /ref folders.

On the Mac, MSBuild's ResolveAssemblyReferences target resolved the reference assemblies (in /ref), passed them to csc to compile and because of that mtouch (our packaging tool) was also given those reference assemblies.
The problem is that we can't AOT them, they're only facades and are not made to be packaged.

We solved the issue in Xamarin.iOS (there might be a more general msbuild fix in the future) by stripping the right reference assemblies, given as output by the Nuget targets in _ReferencesFromNuGetPackages.

Vincent Dondain
  • 430
  • 3
  • 10