Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin iOS - Could not load file or assembly 'System.Threading.Tasks' at startup

Tags:

xamarin

I just upgraded to Xamarin studio 5.9 (build 431), and cannot run my project anymore. It works with a clean project though.

When I run my app, I don't even land in Main.

The Application Output in Xamarin studio prints a bunch of assembly loadings. It gets to MobileClientiOS.app/Newtonsoft.Json.dll [External], then it crashes with the following output:

Could not load file or assembly 'System.Threading.Tasks' or one of its dependencies. The system cannot find the file specified. (System.IO.FileNotFoundException) at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00081] in .../mono/mcs/class/corlib/System/AppDomain.cs:706 at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in .../mono/mcs/class/corlib/System/AppDomain.cs:674 at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in .../mono/mcs/class/corlib/System.Reflection/Assembly.cs:551 at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List 1 assemblies, System.Reflection.Assembly assembly) [0x00019] in .../maccore/src/ObjCRuntime/Runtime.cs:218 at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List 1 assemblies, System.Reflection.Assembly assembly) [0x0002c] in .../maccore/src/ObjCRuntime/Runtime.cs:220 at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List 1 assemblies, System.Reflection.Assembly assembly) [0x0002c] in .../maccore/src/ObjCRuntime/Runtime.cs:220 at ObjCRuntime.Runtime.RegisterEntryAssembly (System.Reflection.Assembly entry_assembly) [0x0001b] in .../maccore/src/ObjCRuntime/Runtime.cs:200 at ObjCRuntime.Runtime.RegisterEntryAssembly (IntPtr a) [0x00000] in .../maccore/src/ObjCRuntime/Runtime.cs:158 at ObjCRuntime.Runtime.register_entry_assembly (IntPtr assembly) [0x00000] in .../maccore/runtime/Delegates.generated.cs:118 at (wrapper native-to-managed) ObjCRuntime.Runtime:register_entry_assembly (intptr) 2015-05-04

MobileClientiOS[77830:1943120] critical: Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

Sorry for the long stacktrace, but I'm out of ideas. We are using PCL's, but there haven't been a problem before this Xamarin Studio-upgrade.

Thank you!


Edit: I downgraded Xamarin.iOS and it's working again. The assembly it seems to fail on is (which now works with the old version):

/MobileClientiOS.app/System.Xml.Linq.dll [External]

How to be able to run with the latest version? I do not know.

like image 799
ullstrm Avatar asked May 04 '15 07:05

ullstrm


1 Answers

To make a guess, I think this might have the same underlying cause as Xamarin Bug 29211.

If that's true, then there's a good chance the same workaround will work:

Under "project options -> iOS Build -> Additional mtouch arguments" add:

-linkskip=System.Threading.Tasks

If that workaround does indeed work, then it's very likely the issue will be fixed in the upcoming service release (due to be released later this week).

Update July 2, 2015

It turns out there is another subtly different common cause of the problem for System.Threading.Tasks. That second bug was originally hidden by Bug 29211 because the two bugs are very similar. The second problem is now being tracked in Xamarin Bug 31560. Note that this bug only affects simulator builds and has fairly simple workarounds, so it is minor in severity.

like image 60
Brendan Zagaeski Avatar answered Oct 09 '22 09:10

Brendan Zagaeski