Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
# Steps to reproduce
# Expected behavior
# Actual behavior
# Supplemental info (logs, images, videos)
# Test environment (full version information)
Xamarin Studio Business
Version 6.1 (build 5441)
Installation UUID: bfbc4269-9411-4b1d-a9a9-c1f09ffab2be
Mono 4.6.0 (mono-4.6.0-branch/746756c) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 406000245
Xamarin Android Player
Apple Developer Tools
Xcode 8.0 (11246)
Version: 18.104.22.168 (Xamarin Business)
Version: 10.0.0.6 (Xamarin Business)
Build date: 2016-09-09 13:01:32-0400
Release ID: 601005441
Git revision: 68292d1ab289911c815ddc715dd7cc29a9752f9f
Build date: 2016-09-09 04:43:23-04
Xamarin addins: ed25d008672663eeb9db55f1ccecb3c24d2fd3b2
Build lane: monodevelop-lion-cycle8
Mac OS X 10.11.6
Darwin Ivans-Mac-mini 15.6.0 Darwin Kernel Version 15.6.0
Mon Aug 29 20:21:34 PDT 2016
Thanks for contacting us, is there any way you could provide us a test case? It does not necessarily needs to be your app project, it can be the binding project plus a fake app project just using a little of the api of the binding so we can reproduce and fix the issue.
OK. Here is stacktrace
Tool /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch execution started with arguments: --cache /Users/developer/Projects/LinkingTest/LinkingTest/obj/iPhone/Debug/mtouch-cache --dev /Users/developer/Projects/LinkingTest/LinkingTest/bin/iPhone/Debug/LinkingTest.app --executable LinkingTest --fastdev --debug --profiling --linksdkonly --sdkroot /Applications/Xcode.app/Contents/Developer --sdk 10.0 --targetver 8.0 --aot-options=-O=float32 --http-message-handler=HttpClientHandler --tls-provider=default --abi=armv7,arm64 --symbollist /Users/developer/Projects/LinkingTest/LinkingTest/obj/iPhone/Debug/mtouch-symbols.list --dsym=no -vvvv --cxx --registrar:static --gcc_flags "-L/Users/developer/Projects/LinkingTest/LinkingTest/../RMSDKWrapper -dead_strip -lstdc++ -lstdc++.6.0.9 -lpthread -lsqlite3 -lxml2 -ObjC -ladept-iOS -lxml-iOS -lz -lcurl -lssl -lcrypto -ldp-iOS -lePub3-iOS -L/usr/lib -I/usr/include/libxml2" -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Xml.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Core.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll -r /Users/developer/Projects/LinkingTest/RMSDKWrapper/bin/Debug/RMSDKWrapper.dll -r /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/mscorlib.dll -r /Users/developer/Projects/LinkingTest/RMSDKWrapper/bin/Debug/RMSDKWrapper.dll --target-framework Xamarin.iOS,v1.0 /Users/developer/Projects/LinkingTest/LinkingTest/bin/iPhone/Debug//LinkingTest.exe
Using Xcode 8.0 found in /Applications/Xcode.app/Contents/Developer
Xamarin.iOS 10.0.0.6 (xcode8: 6c3fee4) using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk
A full rebuild will be performed because the cache is either incomplete or entirely missing.
MTOUCH: error MT0009: Error while loading assemblies: /Users/developer/Projects/LinkingTest/RMSDKWrapper/bin/Debug/RMSDKWrapper.dll
--- inner exception
System.ArgumentNullException: Buffer cannot be null.
Parameter name: buffer
at System.IO.BinaryReader.Read (System.Byte buffer, System.Int32 index, System.Int32 count) [0x0007e] in /private/tmp/source-mono-4.6.0/bockbuild-xamarin/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/io/binaryreader.cs:513
at Mono.Cecil.PE.ImageReader.ReadSectionData (Mono.Cecil.PE.Section section) [0x00039] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/external/cecil/Mono.Cecil.PE/ImageReader.cs:299
at Mono.Cecil.PE.ImageReader.ReadSections (System.UInt16 count) [0x0005c] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/external/cecil/Mono.Cecil.PE/ImageReader.cs:283
at Mono.Cecil.PE.ImageReader.ReadImage () [0x00090] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/external/cecil/Mono.Cecil.PE/ImageReader.cs:104
at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x0000a] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/external/cecil/Mono.Cecil.PE/ImageReader.cs:673
at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x0002a] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/external/cecil/Mono.Cecil/ModuleDefinition.cs:981
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000e] in /Users/builder/data/lanes/3426/6c3fee4d/source/xamarin-macios/external/cecil/Mono.Cecil/ModuleDefinition.cs:963
at MonoTouch.Tuner.MonoTouchResolver.Load (System.String fileName) [0x00077] in <86a99508958c45bc8a05d21e3b49a458>:0
at MonoTouch.Tuner.MonoTouchResolver.Load (System.String fileName) [0x000a7] in <86a99508958c45bc8a05d21e3b49a458>:0
at MonoTouch.Tuner.MonoTouchManifestResolver.Load (System.String file) [0x00040] in <86a99508958c45bc8a05d21e3b49a458>:0
at Xamarin.Bundler.Target.Initialize (System.Boolean show_warnings) [0x00062] in <86a99508958c45bc8a05d21e3b49a458>:0
at Xamarin.Bundler.Application.Initialize () [0x0053b] in <86a99508958c45bc8a05d21e3b49a458>:0
at Xamarin.Bundler.Application.Build () [0x00034] in <86a99508958c45bc8a05d21e3b49a458>:0
at Xamarin.Bundler.Driver.Main2 (System.String args) [0x01c6c] in <86a99508958c45bc8a05d21e3b49a458>:0
at Xamarin.Bundler.Driver.Main (System.String args) [0x0000c] in <86a99508958c45bc8a05d21e3b49a458>:0
Task "MTouch" execution -- FAILED
One thing I forgot to mention, please add
-v -v -v -v
To "Additional mtouch arguments" inside your project settings > Build > iOS build
So we get a more detailed build logs
there is -vvvv
and here is test proj
@Dmitry thanks for providing a test case, I'll be looking into this asap.
I do get the same error, thanks!
MTOUCH: error MT1010: Could not load the assembly '/Users/poupou/Downloads/LinkingTest/LinkingTest/obj/iPhoneSimulator/Debug/mtouch-cache/Link/RMSDKWrapper.dll': Error while loading assemblies: /Users/poupou/Downloads/LinkingTest/LinkingTest/obj/iPhoneSimulator/Debug/mtouch-cache/Link/RMSDKWrapper.dll
MTOUCH: error MT0009: Error while loading assemblies: /Users/poupou/Downloads/LinkingTest/LinkingTest/obj/iPhoneSimulator/Debug/mtouch-cache/Link/RMSDKWrapper.dll
RMSDKWrapper.dll is quite large, at 1,302,935,040 bytes. Ideally it would be broken down as several dependencies (that would help the build performance).
If I run the build with Mono 4.4 it does works , but it fails with Mono 4.6.
Can you try:
1. using mono 4.4.x;
2. edit /Library/Frameworks/Xamarin.iOS.framework//Versions/Current/bin/mtouch
and change `mono` to `mono64` (the 64 bits version of mono).
In both case I got farther in the compilation process and the errors seems legit (and likely related to the test case).
Rollback to August Xamarin Build helped, but it's not good on perspective.
Most of .a files are prebuild third-party libs (some of them 300-400mb) used by Adobe Reader Mobile SDK (RMSDK) so I have no idea, how to separate them.
@Dmitry it's a workaround, not the fix :) but you should be able to _only_ downgrade mono (and not the rest of the tooling).
As for RMSDKWrapper.dll I did not mean to split the .a (they are not yours and should not be modified) but to move most (all but librmsdk_wrapper2_iOS.a) outside the binding project. That results in a .dll that's only 25MB (and will speed up your builds).
Native references in a binding projects all gets embedded in the .dll. That's quite handy for sharing a self-contained binary component but it was not meant to include all dependencies.
The other static libraries are still needed and you can use native references on your main project (without them being embedded). The end result will be the same, but this is less resource intensive.
Oh thanks, that should be somewhere in tutorials, but them are too simple.
I'll try that again. First time I wasn't able to compile them all together without adding to binding, may be now I will.
btw, is status NEEDINFO correct?
NEEDINFO, yes until you confirm the workaround works for you. That will assure me* there's not other errors from your application and the the full extent of the issue is known. Sometimes the test case only expose half of the problem :)
* your sample launch on device for me (and the throw an ArgumentNullException which is expected as null is provided).
workaround with downgrading works, thx.
what about shrinking library, I definitely do something wrong.
Created attachment 17682 [details]
Moving .a to the main app native references
This is how I re-structured your test case locally.
Only the .a being bound is in the binding project, all other dependencies are directly added to the main app.
PR (master) https://github.com/xamarin/xamarin-macios/pull/887
A workaround is to edit the mtouch script
and change `mono` to `mono64`
*** This bug has been marked as a duplicate of bug 44122 ***
I am not authorised to see the bug 44122, but am interested in seeing the resolution. Should I post a new bug?
@Sergey, Sebastien posted the resolution of bug 44122 here in comment #16.
@Rolf, I thought it was a temporary workaround - does that mean that a real fix will only be available with a new update of the Mono?
@Sergey, it is the actual fix, and it will be included in the next version of Xamarin.iOS. If you don't want to wait, you can implement the fix yourself (since it's just modifying a text file).
For reference here's our fix: https://github.com/xamarin/xamarin-macios/commit/eb91e692a675d44ac43d8e326049e250e21473b4
@Rolf Thank you, Rolf, got it.