Bug 29697 - Build for device (Debug and AdHoc) throws Unexpected Error (MT0000)
Summary: Build for device (Debug and AdHoc) throws Unexpected Error (MT0000)
Status: RESOLVED NORESPONSE
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: master
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-05-04 06:17 UTC by chris
Modified: 2016-06-09 00:18 UTC (History)
5 users (show)

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

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:
Status:
RESOLVED NORESPONSE

Description chris 2015-05-04 06:17:25 UTC
I've just upgraded to the latest Studio and Xamarin.iOS versions and now get the following error when I try to target a device in either Debug or AdHoc configurations

MTOUCH: Error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com (MT0000) 

In the 'Deploying to device' tab I get the following:

Connected to: Chris's iPhone
Installing application bundle
writeDictToFile:1241 open failed for /Users/chrisxxx/Documents/Initial/Mobile Clients/project.xxx/obj/iPhone/Debug/mtouch-cache/install-shadow-directory/81e4987d614589510b1fb4b760792c7b/baf4e0a957466b04f272d9cae571a43b1c1f4a09/ManifestCache.plist : No such file or directory
MDMCacheDirectoryManifest:1315 writeDictToFile failed to write to /Users/chrisxxx/Documents/Initial/Mobile Clients/project.xxx/obj/iPhone/Debug/mtouch-cache/install-shadow-directory/81e4987d614589510b1fb4b760792c7b/baf4e0a957466b04f272d9cae571a43b1c1f4a09/ManifestCache.plist : No such file or directory
error MT1006: Could not install the application '/xxx/bin/iPhone/Debug/xxx.app' on the device Chris's iPhone: Application Verification Failed Error (error: 0xe800003a).
The application was terminated by a signal: SIGHUP







Here is the information about my installation:

=== Xamarin Studio ===

Version 5.9 (build 431)
Installation UUID: 4e7a8b28-b1e8-4f65-9910-dd21d038725e
Runtime:
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

=== Xamarin.Android ===

Version: 5.1.0.115 (Business Edition)
Android SDK: /Users/chriskoiak/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.0.267 (Business Edition)
Hash: 6481535
Branch: master
Build date: 2015-04-27 04:38:13-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 19:25:48-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e

=== Operating System ===

Mac OS X 10.10.3
Darwin Chriss-MacBook-Pro.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 1 Parmendra Kumar 2015-05-04 07:46:32 UTC
I have checked this issue but I am not able to reproduce this issue. To reproduce this issue I have followed steps:
1. Create a iOS app on ( XS 5.9 (build 431),X.iOS 8.10.0.267)
2. Deploy the app on device 

observed that the app successfully deploy on device.

3. Upgrade the build to (XS 5.9 (build 457),iOS 8.10.1.11 )
4. Deploy the app on device 

observed that the app successfully deploy on device.

Screencast: http://www.screencast.com/t/rT75RqAU8r0e

Please let me know if I have missed anything.
Could you please provide us sample project and IDE log? So that We can reproduce this issue at our end.

Environment info: 

=== Xamarin Studio ===

Version 5.9 (build 457)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Runtime:
	Mono 4.0.1 ((detached/5a0b19f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010024

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.1.11 (Enterprise Edition)
Hash: d153c60
Branch: master
Build date: 2015-05-01 11:26:36-0400

=== Xamarin.Android ===

Version: 5.1.0.77 (Enterprise Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.1.12 (Enterprise Edition)

=== Build Information ===

Release ID: 509000457
Git revision: c27961c1dcfe2f8b5e5bb525c5dff33ce18a873c
Build date: 2015-04-30 19:35:14-04
Xamarin addins: df9b5918c9f7aca6da509fe3e5a62553aa101910

=== Operating System ===

Mac OS X 10.9.4
Darwin ShrutiMac.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 2 chris 2015-05-04 07:51:56 UTC
What log do you want and where can I find it?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-05-04 07:58:51 UTC
@Chris, try the following:

* Remove your app from the device.
* Clean & rebuild the solution.
* Try to deploy again.

If it still fails, please get the iOS Device Log for the failed deploy attempt (you can get the device log from the menu View -> Pads -> iOS Device Log).
Comment 4 chris 2015-05-04 16:25:07 UTC
I'm not getting as far as deploying. I'm only selecting 'Build all' (after a Clean)

My configuration is set to 'Debug | iPhone' and it doesn't matter the  target device (both 'Chris's iPhone and an unplugged 'iOS device' fail).

Do you still want to logs?
Comment 5 Sebastien Pouliot 2015-05-04 17:35:47 UTC
@Chris you mentioned two issues. It seems you're stuck at the first one (MT0000). We'll need the full build log (not the same as above for deployment) to see what caused that error.

Please add `-v -v -v -v` to your "Additional mtouch arguments" (in the Project's options, iOS Build) and do a Rebuild (or Clean and Build). Once the build is completed attach the "Build Output" (from the Errors pad) to the bug report. Thanks.
Comment 7 Sebastien Pouliot 2015-05-04 19:57:01 UTC
Thanks, that MT0000 is a duplicate of bug #28918. There are workaround inside the bug report to get you going (until we release a fix). 

Can you tried them to see if the MT1006 error again ? that should not be related to the other issue (since no .app bundle was generated)
Comment 8 chris 2015-05-05 04:27:44 UTC
Hi,

I've added the following workarounds:

1) --linkskip=mscorlib mtouch argument
2) typeof (System.Security.Permissions.FileIOPermissionAccess).ToString (); in FinishedLaunching()

I now get a different error: /xxx/MTOUCH: Error MT2001: Could not link assemblies. Reason: Argument cannot be null. (MT2001) 

Build Output attached.
Comment 10 Sebastien Pouliot 2015-05-05 08:06:39 UTC
* Which of (1 or 2) workarounds did you try ?

* What happens when you change your settings to "Don't link" ?
Comment 11 chris 2015-05-05 08:42:09 UTC
I tried both workarounds. The second one didn't seem to make any difference if the first was applied.

Setting 'Don't link' fixes the MT2001 issue and the app now builds and runs on the device. 

I can also build an Adhoc build with 'Link SDK only' and it generates the ipa correctly.

Thanks.
Comment 12 Sebastien Pouliot 2015-05-05 08:56:52 UTC
The linker does not know about Adhoc (vs Debug or Release...) so the results should be identical. Have you tried #2 alone ? 

Both workarounds were meant to be used alone, #1 the easiest to try and #2 with the lesser impact (but, if you have multiple security declarations then it might requires a few more lines of code to cover each case).

note: disabling the linker will make your builds longer, i.e. more code to AOT and to deploy to your device. The time difference might be negligible for small applications but it can be significant for large ones.
Comment 13 chris 2015-05-05 09:08:07 UTC
If I try #2 on it's own then it builds without generating the MT2001 error. So workaround #2 fixed my original problem without introducing MT2001 error.

My builds went from 14Mb to 38Mb with linking disabled (ouch!).
Comment 14 Benoit Jadinon 2015-05-14 08:38:29 UTC
2 cents : #1 (--linkskip=mscorlib) worked for me first time
Comment 15 Sebastien Pouliot 2015-05-14 10:03:42 UTC
In such case the workarounds should be, from easy to hard:

1. Use "Don't link", very easy but has a huge impact on app size;

2. --linkskip=ASSEMBLY, easy (need to select the right assemblies), less impact on app size;

3. Preserve the missing type(s), e.g.

typeof (System.Security.Permissions.FileIOPermissionAccess).ToString ();

it's harder, you need to identify the right types (and there could be more than one) but it has the smallest impact (often none at all).

The original issue was fixed in @28918, which is now available in 8.10.1 (alpha channel).

@Chris can you try, without the workarounds, 8.10.1 to confirm it works ?

The last MT2001 (comment #9) is a different issue (which can only happen when doing a --linkskip on mscorlib) and I'll fix this separately. Thanks.
Comment 16 Sebastien Pouliot 2015-05-14 10:34:34 UTC
MT2001 tracked in -> https://bugzilla.xamarin.com/show_bug.cgi?id=30075
Comment 17 Sebastien Pouliot 2016-06-09 00:18:06 UTC
We have not received the requested confirmation. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!