Bug 37934 - [Windows only] `mtouch --datafile` fails intermittently with non-zero exit code, leading to "Unhandled Activation Error... Could not load machine data:"
Summary: [Windows only] `mtouch --datafile` fails intermittently with non-zero exit co...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- major
Target Milestone: 4.2.0 (C8)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-22 20:38 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-07-07 08:51 UTC (History)
7 users (show)

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


Attachments
Experimental mtouch with candidate fix (4.79 MB, application/zip)
2016-02-03 07:15 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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 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:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2016-01-22 20:38:34 UTC
[Windows only] `mtouch --datafile` fails intermittently with non-zero exit code, leading to "Unhandled Activation Error... Could not load machine data:"


This is a new bug to discuss an old tricky problem where `mtouch --datafile` sometimes (intermittently on any particular customer's machine) returns a non-zero error code on Windows. This makes Xamarin.iOS activation impossible until the command "spontaneously" starts working again. The problem often lasts for several days in a row or longer.

Curiously the number of customer reports of this version of the "Could not load machine data" error seems to have increased recently. For a long time it appeared that the attempted fix from Bug 23537 might have eliminated the problem. But unfortunately the incoming reports now indicate that the fix did not fully resolve the issue.

The recent increase in number of customer reports does _not_ seem to be related to the Xamarin version, so perhaps there is some other environmental factor that could have changed across several customer computers recently (for example, maybe a Windows system update, or maybe even something as simple as the system clock date).




## The primary error message observed in the IDE during attempted activation

Importantly this exception message does not show any additional output from the standard error of `mtouch`. There are other causes of the "Could not load machine data:" error, but so far all reports of those other problems have had different stack traces or have included additional messages from the standard error of `mtouch`.

(If any additional messages from standard error were available, they would be appended after the "Could not load machine data:" text.)

> System.Exception: Could not load machine data:
>   at Xamarin.Components.Ide.Activation.ActivationService.GetErrorWorkflow(LicenseSyncResult[] results, Boolean ignoreSyncErrors)
>   at Xamarin.Components.Ide.Activation.ActivationService.<GenerateFullWorkflowSequence>d__89.MoveNext()
>   at Xamarin.Components.Ide.Activation.ActivationDialog.DisplayWorkflowStep(ActivationWorkflowStep step)
>   at Xamarin.Components.Ide.Activation.ActivationDialog.<>c__DisplayClass13.<StartSpinnerTaskAndScheduleContinuation>b__12(Task t)




## Possible next steps

1. Several of the customers who have reported this problem use Active Directory to log in to Windows. The Xamarin QA team will be trying some extra testing of this scenario to watch for this intermittent error.


2. I am wondering if there are any logging statements that could be added to a custom version of the `mtouch` binary, so that we could send that to customers who are currently hitting this issue. Perhaps that would be a way to locate the precise execution step that causes the command to quit with a non-zero exit status?




Thanks!
Comment 2 Sebastien Pouliot 2016-01-22 21:54:04 UTC
The mtouch command that ships on Windows is a different binary than the one from the Mac.
Comment 8 Brendan Zagaeski (Xamarin Team, assistant) 2016-01-28 04:56:30 UTC
## Status update

The engineers have an idea for what might be causing this. Work is underway to create a new `mtouch` executable that uses an improved build process to integrate updated dependencies. As of today that new build process appears to be integrating the correct dependencies, but there is one remaining issue preventing the executable from running properly on target machines.

I will update this bug report again when a runnable candidate build is available for user testing. To give a tentative initial estimate, that build might be available before the end of the week (Friday, January 28). If the build is not available by the end of the day on Friday, I will post another status update at that time.
Comment 9 Brendan Zagaeski (Xamarin Team, assistant) 2016-01-30 05:03:32 UTC
I now have the new candidate development build of `mtouch.exe` mentioned in Comment 8. I have sent that candidate build to several individual users.

I will update this bug when I hear back from those users about whether this new build has helped.

If any other users would like to try this candidate build, feel free to send a quick email to contact@xamarin.com and mention this particular bug comment (Bug 37934, Comment 9).




## For record keeping: hashes of the candidate development build I have sent out

(I will list these here for thorough record keeping in case I send out another different candidate build in the future.)

### MD5 sum

MD5 (mtouch.exe) = b5c175dfa77e55d26c2cfbde0d019427


### SHA-1 sum

516e97e39280aee4dc98fdcc1d2128a7274b796c  mtouch.exe


### SHA-256 sum

7c8e6db930c7fbba8d368f1978133203eb92cc898e3d21d351e1011de617e4f6  mtouch.exe
Comment 10 Brendan Zagaeski (Xamarin Team, assistant) 2016-02-01 21:56:19 UTC
## Preliminary verification: so far so good

2 customers have reported that the candidate development build mentioned in Comment 9 has solved this problem at least during 1 day of usage so far.

I will update the bug again if there are new reports where the candidate build fails again in the same way as described in Comment 0, but for now I will tentatively mark the bug as RESOLVED to request that this candidate fix be incorporated into a future release.
Comment 11 Brendan Zagaeski (Xamarin Team, assistant) 2016-02-03 07:15:06 UTC
Created attachment 14860 [details]
Experimental mtouch with candidate fix

## Steps to test this experimental build



1. Download and unzip the `.zip` file to get the `mtouch.exe` file.



2. Move the old original `mtouch.exe` to a backup location. The original file is located in:

"C:\Program Files (x86)\MSBuild\Xamarin\iOS\mtouch.exe"



3. Copy the new `mtouch.exe` file into that folder: 

"C:\Program Files (x86)\MSBuild\Xamarin\iOS"



4. Re-try activating Xamarin.iOS in Visual Studio. You might see a command prompt that opens briefly when you run these steps. You can safely ignore that.
Comment 12 Oleg Demchenko 2016-03-05 00:37:27 UTC
Moving to C7
Comment 13 Arpit Jha 2016-06-02 11:31:48 UTC
@Brendan, I have checked this issue with steps mentioned in comment 11 

i.e replacing attached mtouch.exe with "C:\Program Files (x86)\MSBuild\Xamarin\iOS\mtouch.exe"  and I am able to connect and deploy application on simulator.

Please let me know If I have to follow some specific steps to reproduce this issue.

Thanks
Comment 14 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-10 14:38:28 UTC
Due to the "Xamarin for Everyone" changes, the new version of `mtouch.exe` was pushed back to a later release.  I am updating the target milestone accordingly.
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-10 14:41:28 UTC
For reference, "Xamarin for Everyone" is discussed in https://blog.xamarin.com/xamarin-for-all/.
Comment 16 Arpit Jha 2016-07-05 10:16:54 UTC
@Brendan, As per comment 13 I was able to see mtouch.exe at this location.  "C:\Program Files (x86)\MSBuild\Xamarin\iOS\mtouch.exe" 

Today I checking with master XVS 99.0.0.2789 (5cddab2) and not getting mtouch.exe at C:\Program Files (x86)\MSBuild\Xamarin\iOS\

Please suggest Is this intended behavior.

Note: I am able to build and deploy application successfully.

Env Info: https://gist.github.com/tajinder360/6e26d2698d29e879abb84970b600d581
Comment 17 Brendan Zagaeski (Xamarin Team, assistant) 2016-07-05 18:16:41 UTC
Yes, that is expected behavior.  As I recall, Cycle 8 is removing the old `mtouch.exe` binary altogether.  So this bug will be approximately "fixed" or "not on roadmap" in Cycle 8.
Comment 19 Arpit Jha 2016-07-07 08:51:03 UTC
As per comment 17 I am closing this issue.