Bug 40640 - Xamarin studio failed with MT0000
Summary: Xamarin studio failed with MT0000
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.8 (tvOS / C7)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-04-22 11:27 UTC by Pavlo Tunyk
Modified: 2016-06-08 02:55 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Xamarin Studio beta build log (1.69 MB, text/plain)
2016-04-22 11:27 UTC, Pavlo Tunyk

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Pavlo Tunyk 2016-04-22 11:27:12 UTC
Created attachment 15816 [details]
Xamarin Studio beta build log

We are trying to embed Citrix MDX SDK into our Xamarin forms app. Currently we experience problems only with iOS. When creating Ad-Hoc binary xamarin studio throws error in build log:
MTOUCH: error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
		System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
		  at System.IO.BinaryReader.FillBuffer (Int32 numBytes) <0x111466fa0 + 0x0015e> in <filename unknown>:0 
		  at System.IO.BinaryReader.ReadUInt32 () <0x111467770 + 0x00015> in <filename unknown>:0 
		  at Xamarin.MachOFile.Read (System.IO.BinaryReader reader) <0x11b2a4fd0 + 0x00113> in <filename unknown>:0 
		  at Xamarin.FatEntry.ReadEntry (System.IO.BinaryReader reader) <0x11b2a4f10 + 0x000a3> in <filename unknown>:0 
		  at Xamarin.FatFile.Read (System.IO.BinaryReader reader) <0x11b2a4ab0 + 0x001a4> in <filename unknown>:0 
		  at Xamarin.MachO.ReadFile (System.IO.BinaryReader reader, System.String filename) <0x11b2a48e0 + 0x000f6> in <filename unknown>:0 
		  at Xamarin.MachO.ReadFile (System.String filename) <0x11b2a4790 + 0x000bf> in <filename unknown>:0 
		  at Xamarin.MachO.SelectArchitectures (System.String filename, ICollection`1 abis) <0x11b2a3210 + 0x0017e> in <filename unknown>:0 
		  at MonoTouch.Application.BuildFinalExecutable () <0x11b2a1140 + 0x00610> in <filename unknown>:0 
		  at MonoTouch.Application.Build () <0x11145b120 + 0x00121> in <filename unknown>:0 
		  at MTouch.Main2 (System.String[] args) <0x10ef89200 + 0x074b7> in <filename unknown>:0 
		  at MTouch.Main (System.String[] args) <0x10eedde60 + 0x00069> in <filename unknown>:0 
	Task "MTouch" execution — FAILED

We switched xamarin studio to latest beta and it failes in difference way now, attached to ticket full log. It's really important task for us.
Comment 1 Sebastien Pouliot 2016-04-22 13:04:51 UTC
That happens (in 9.6 and earlier) when using a "fake" framework, i.e. a static library (for native code) that looks like a framework (but it not really one).

You'll need to update XI to 9.8.x (beta channel) to have a fix for this. A workaround is detailed in https://bugzilla.xamarin.com/show_bug.cgi?id=38711#c1

*** This bug has been marked as a duplicate of bug 36505 ***
Comment 2 Pavlo Tunyk 2016-04-22 13:10:09 UTC
The frameworks added as native references by editing csproj as described https://developer.xamarin.com/guides/ios/advanced_topics/embedded_frameworks/.

Should the native references be removed and referenced as workaround for ticket https://bugzilla.xamarin.com/show_bug.cgi?id=38711#c1 described?
Comment 3 Pavlo Tunyk 2016-04-22 13:15:32 UTC
This is my current setup:
Xamarin Studio Community
Version 6.0 (build 4968)
Installation UUID: 4f023631-906d-4bca-a6e0-404da7337663
	Mono 4.4.0 (mono-4.4.0-branch/a3fabf1) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000122

Not Installed

Version: (Xamarin Studio Community)
Android SDK: /Users/tunyk/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:

Xamarin Android Player
Not Installed

Apple Developer Tools
Xcode 7.3 (10183.3)
Build 7D175

Version: (Xamarin Studio Community)
Hash: 977921b
Branch: cycle7
Build date: 2016-04-07 14:20:17-0400

Not Installed

Build Information
Release ID: 600004968
Git revision: ab7092ce63351276394f283e4f9c8646baf51fce
Build date: 2016-04-08 09:30:34-04
Xamarin addins: be0a0aef6ec8b075b4ba4690bd147d1e33c2abd7
Build lane: monodevelop-lion-cycle7

Operating System
Mac OS X 10.11.4
Darwin PTU-MAC.local 15.4.0 Darwin Kernel Version 15.4.0
    Fri Feb 26 22:08:05 PST 2016
    root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

The way you described didn't work.
Comment 4 Sebastien Pouliot 2016-04-22 14:29:11 UTC
Please attach a self-contained test case that shows the issue and we'll have a look into it.
Comment 5 Pavlo Tunyk 2016-04-26 07:21:10 UTC

Here is test project, please run it in release mode pointed to iOS device. You will see message in the build output.
Comment 6 Sebastien Pouliot 2016-04-26 16:00:58 UTC
I can build your attached solution without any error on my side. I can see warnings about the _frameworks_ as they are not _real_ frameworks, and are being treated as static libraries (what they really are).

	The framework MDXSDK/CitrixLogger.framework is a framework of static libraries, and will not be copied into the app.
	The framework MDXSDK/Worx.framework is a framework of static libraries, and will not be copied into the app.

Can you attach a full build log to the bug report ? 

The one presently attached does not show the MT0000 error. Make sure you add "-v -v -v -v" to the "Additional mtouch arguments" of your project and do a clean first. Thanks!
Comment 7 Pavlo Tunyk 2016-04-27 11:00:00 UTC
Hi Sebastien,
It's already there.

The "Additional touch arguments" should be:

 -cxx -v -v -v -v -gcc_flags "-lsqlite3 -ObjC -lxml2 -u _FIPS_text_start -u _FIPS_text_end -u _FIPS_rodata_start -u _FIPS_rodata_end -framework AssetsLibrary -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreLocation -framework CoreTelephony -framework JavaScriptCore -framework LocalAuthentication -framework MessageUI -framework MobileCoreServices -framework Photos -framework QuickLook -framework Security -framework Social -framework SystemConfiguration -lresolv -lstdc++ -lz"

Check the project settings please.

BR, Pavlo Tunyk.
Comment 8 Sebastien Pouliot 2016-04-28 14:27:15 UTC
Yes, the arguments are in the project you attached. However the project builds fine in my computer, so something else must differs on your computer.

Your original logs did not include the MT0000 error, nor the call to `mtouch` with the `-v -v -v -v`, so I cannot see what went wrong on using it.

Can you update to the latest XI 9.8.x release (beta channel) and attach the new build log (after a clean) to the bug report? Thanks!
Comment 9 Alex Soto [MSFT] 2016-06-08 02:55:31 UTC
We have not received the requested information. If you are still 
experiencing this issue please provide all the requested information 
and re-open the bug report. Thanks!