Bug 46279 - [XVS 4.2.0.719] "C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate ... Assertion at ..\mono\metadata\class.c:5078, condition `class' not met" when attempting to create Android packages in the Release configuration
Summary: [XVS 4.2.0.719] "C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolic...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Installer (show other bugs)
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- critical
Target Milestone: 4.3.0 (C9)
Assignee: Bugzilla
URL:
: 43833 44105 46164 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-11-02 00:52 UTC by Brendan Zagaeski (Xamarin Support)
Modified: 2016-12-30 08:55 UTC (History)
10 users (show)

See Also:
Tags: BZRC8SR0S3_C8SR0S2
Is this bug a regression?: Yes
Last known good build: XamarinVS 4.2.0.703 (3b7df6f)


Attachments
Diagnostic build output for both BAD and GOOD versions (116.62 KB, application/zip)
2016-11-02 00:52 UTC, Brendan Zagaeski (Xamarin Support)
Details
BAD mono-symbolicate from 4.2.0.719 (4.80 MB, application/zip)
2016-11-02 17:43 UTC, Brendan Zagaeski (Xamarin Support)
Details
GOOD mono-symbolicate from 4.2.1.52 (4.89 MB, application/zip)
2016-11-02 17:44 UTC, Brendan Zagaeski (Xamarin Support)
Details

Description Brendan Zagaeski (Xamarin Support) 2016-11-02 00:52:26 UTC
Created attachment 18294 [details]
Diagnostic build output for both BAD and GOOD versions

[XVS 4.2.0.719] "C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate ... Assertion at ..\mono\metadata\class.c:5078, condition `class' not met" when attempting to create Android packages in the Release configuration


As mentioned in duplicate Bug 46164, Comment 13, this issue appears to be caused by a "bad" copy of `mono-symbolicate.exe` that was somehow packaged into this _specific_ Xamarin.VisualStudio installer.

Could this have been caused by a build environment issue on the particular build bot that created this particular installer package?  That could potentially explain why the issue has somewhat "mysteriously" appeared and disappeared in other earlier reports of the problem:

- Bug 43833
- Bug 44105




## Partial workaround

Open the Android app project .csproj file in a text editor and change the following line anywhere that it appears to say "false" instead of "true":

<AndroidManagedSymbols>true</AndroidManagedSymbols>

(Note that this will _disable_ the mono-symbolicate step entirely, so you might prefer to upgrade to the current Beta version (from 2016-11-01) or downgrade to the previous Stable version (from 2016-10-04) instead to be able to continue to take advantage of the mono-symbolicate feature.)




## Regression status: Regression in XamarinVS 4.2.0.719 compared to 4.2.0.703

> BAD:  XamarinVS 4.2.0.719 (15694b9) (with Xamarin.Android 7.0.1.6  (5a02b03)) "Xcode 8.1 compatibility update"      (2016-10-27)
> GOOD: XamarinVS 4.2.0.703 (3b7df6f) (with Xamarin.Android 7.0.1.3  (96c7ba6)) "Cycle 8 – Service Release 0"         (2016-10-04)
> GOOD: XamarinVS 4.2.0.680 (c4382f5) (with Xamarin.Android 7.0.0.18 (0e59c36)) "Cycle 8"                             (2016-09-13)



## Verification status: verified not replicable in the current 2016-11-01 Beta builds of "Cycle 8 – Service Release 1"

> GOOD: XamarinVS 4.2.1.52  (76d5fac) (with Xamarin.Android 7.0.2.37 (ce955cc)) "Cycle 8 – Service Release 1, Beta 2" (2016-11-01)
> BAD:  XamarinVS 4.2.0.719 (15694b9) (with Xamarin.Android 7.0.1.6  (5a02b03)) "Xcode 8.1 compatibility update"      (2016-10-27)



## mono-symbolicate.exe file version info

> GOOD 4.2.1.52  (76d5fac): 11/01/2016  11:07 AM  6,600,704  mono-symbolicate.exe  (MD5: 1cd12d6b3720b9d3bbde5993cfa6b62b)
> BAD  4.2.0.719 (15694b9): 10/27/2016  01:06 PM  6,508,544  mono-symbolicate.exe  (MD5: 28504c4d448ed5971759d46d9e454739)
> GOOD 4.2.0.703 (3b7df6f): 10/04/2016  07:09 AM  6,600,704  mono-symbolicate.exe  (MD5: c5dea2411ae56305b962105b596db9c4)
> GOOD 4.2.0.680 (c4382f5): 09/12/2016  07:46 PM  6,600,704  mono-symbolicate.exe  (MD5: d74e5126deb5a1d0a12ff247056bb1fc)



## Steps to replicate


1. Create a new "Visual C# > Android > Blank App (Android)" project.

Side note: In all of the versions that I tested for verification and regression (as recorded above), this template app sets the `<AndroidManagedSymbols>true</AndroidManagedSymbols>` property as part of the "Release|AnyCPU" configuration, so the build process _does_ try to run the mono-symbolicate program in every case.


2. Run the "PackageForAndroid" target on the project in the "Release" configuration.  For example, run the following msbuild command (example for MSBuild Tools 2015):

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /p:Configuration="Release" /t:PackageForAndroid AndroidApp1\AndroidApp1.csproj




## BAD Results

The build fails due to an error when running `mono-symbolicate.exe`.

### Excerpt from the BAD diagnostic MSBuild output for the _CopyPackage target with XamarinVS 4.2.0.719 (15694b9)

> Task "Exec" (TaskId:200)
>   Task Parameter:Command="C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\AndroidApp1.AndroidApp1.apk.mSYM" "obj\Release\android/assets" (TaskId:200)
>   "C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\AndroidApp1.AndroidApp1.apk.mSYM" "obj\Release\android/assets" (TaskId:200)
>   * Assertion at ..\mono\metadata\class.c:5078, condition `class' not met (TaskId:200)
>    (TaskId:200)
> C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2289,3): error MSB3073: The command ""C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\AndroidApp1.AndroidApp1.apk.mSYM" "obj\Release\android/assets"" exited with code -1073740791. [C:\source\AndroidApp1\AndroidApp1\AndroidApp1.csproj]
> Done executing task "Exec" -- FAILED. (TaskId:200)



## GOOD Results

The `mono-symbolicate` Exec task runs and does not cause the build to abort.



### Excerpt from the GOOD diagnostic MSBuild output for the _CopyPackage target with XamarinVS 4.2.1.52 (76d5fac) or 4.2.0.703 (3b7df6f)

> Task "Exec" (TaskId:200)
> Task Parameter:Command="C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\AndroidApp1.AndroidApp1.apk.mSYM" "obj\Release\android/assets" (TaskId:200)
> "C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\AndroidApp1.AndroidApp1.apk.mSYM" "obj\Release\android/assets" (TaskId:200)
> Done executing task "Exec". (TaskId:200)



## Additional testing environment info (brief)

Microsoft Visual Studio Enterprise 2015
Version 14.0.25425.01 Update 3
Microsoft .NET Framework
Version 4.6.01055

Windows 8.1 Version 6.3 (Build 9600)
Comment 1 Brendan Zagaeski (Xamarin Support) 2016-11-02 01:10:46 UTC
*** Bug 46164 has been marked as a duplicate of this bug. ***
Comment 2 Brendan Zagaeski (Xamarin Support) 2016-11-02 01:15:16 UTC
*** Bug 43833 has been marked as a duplicate of this bug. ***
Comment 3 Brendan Zagaeski (Xamarin Support) 2016-11-02 01:16:14 UTC
*** Bug 44105 has been marked as a duplicate of this bug. ***
Comment 4 Brendan Zagaeski (Xamarin Support) 2016-11-02 01:29:23 UTC
## Supplemental test for the default value of `AndroidManagedSymbols`

1A. Complete step (1) from Comment 0.

1B. Manually delete the `<AndroidManagedSymbols>true</AndroidManagedSymbols>` line from the Release configuration in the .csproj file.

2. Now proceed to step (2) from Comment 0.



### Results

The default value of `AndroidManagedSymbols` is False in both 4.2.0.719 and 4.2.1.52.  This means the default is unchanged between the 2 versions and is not related to the regression that appeared in 4.2.0.719.

On both 4.2.0.719 and 4.2.1.52, the `mono-symbolicate` step doesn't run at all.  This is recorded in the diagnostic build output as follows:

> Task "Exec" skipped, due to false condition; ( '$(AndroidManagedSymbols)' == 'True' ) was evaluated as ( 'False' == 'True' ).
Comment 6 Zoltan Varga 2016-11-02 17:27:25 UTC
Could you attach the 'bad' and 'good' versions of the executable, or is there a way to download it ?
Comment 7 Brendan Zagaeski (Xamarin Support) 2016-11-02 17:39:26 UTC
Yeah I have them handy.  Let me attach them.  One sec.
Comment 8 Brendan Zagaeski (Xamarin Support) 2016-11-02 17:43:23 UTC
Created attachment 18304 [details]
BAD mono-symbolicate from 4.2.0.719
Comment 9 Brendan Zagaeski (Xamarin Support) 2016-11-02 17:44:01 UTC
Created attachment 18305 [details]
GOOD mono-symbolicate from 4.2.1.52
Comment 10 Zoltan Varga 2016-11-02 18:19:35 UTC
I cannot run/disassemble either of those executables, they don't seem to be valid .net executables.
Comment 11 Brendan Zagaeski (Xamarin Support) 2016-11-02 19:45:57 UTC
Yep, they're mkbundle'd.  I suspect the interesting question might be to map out how the mono-symbolicate.exe is getting into the final .msi in each case.  As a start to that I'll see if 4.2.0.718 (the build immediately preceding the "bad" build) is good or bad, and then I'll see if I can map out anything about how mono-symbolicate.exe is being included into .msi.
Comment 12 Zoltan Varga 2016-11-02 19:51:02 UTC
The mkbundled version is generated by makefile.win32 in the xamarin/monodroid repo.
Comment 13 Brendan Zagaeski (Xamarin Support) 2016-11-02 20:25:39 UTC
For further reference, 4.2.0.718 is GOOD.  And the contents of the 1 commit difference between .718 and .719 (commit 15694b9) is an empty to commit to a readme file, so the contents of that commit itself are not interesting.  I will see what else I can uncover about other differences between these 2 builds.

> BAD  4.2.0.719 (15694b9): 10/27/2016  01:06 PM  6,508,544  mono-symbolicate.exe  (MD5: 28504c4d448ed5971759d46d9e454739)
> GOOD 4.2.0.718 (f9c2e25): 10/26/2016  02:36 PM  6,600,704  mono-symbolicate.exe  (MD5: 616109e7be872440f41f35cfe7615c8c)
> GOOD 4.2.0.703 (3b7df6f): 10/04/2016  07:09 AM  6,600,704  mono-symbolicate.exe  (MD5: c5dea2411ae56305b962105b596db9c4)


(As a further sanity-checking step I also re-downloaded the BAD version from Wrench and re-confirmed that it contained the "bad" version of mono-symbolicate: it did.)
Comment 14 Brendan Zagaeski (Xamarin Support) 2016-11-02 20:40:34 UTC
I'll continue to dig into this, but one quite possibly interesting bit of information is that the two known BAD builds so far (9ba04a6 and 15694b9) list the following for the Mono version on the Windows build bot:

> Mono JIT compiler version 4.0.3


Whereas all 4 of the GOOD versions I've tested in previous comments (3b7df6f, f9c2e25, c4382f5, 76d5fac) list a newer Mono version on the Windows build bot:

> Mono JIT compiler version 4.2.2
Comment 16 Brendan Zagaeski (Xamarin Support) 2016-11-02 21:02:38 UTC
Yup.  This all adds up.  The mkbundling is of course performed on Windows to create a Windows executable.  The mkbundling happens during _each_ XamarinVS build.  A line that roughly matches the following is part of the installer_build.txt log for each build:

> Running "mono" C:\Users\builder\mkbundle_4.2\mkbundle.exe -o ... mono-symbolicate.exe ...


I believe this also explains why the MD5 of the "good" version of mono-symbolicate keeps changing.




## Resolution of this bug

It will be necessary to ensure that Mono 4.2.2 or newer is installed on the Windows bots for all future builds of XamarinVS.
Comment 21 Jatin 2016-12-28 10:56:22 UTC
I have checked this issue with latest master build i.e. Xamarin.VisualStudio_99.1.0.392_8d8edf11ec2a90e1ef8038c46167250513e9b366 and getting same behavior given in the bug description. Getting error in output.
Here is the Output: https://gist.github.com/saurabh360/7c6f1da2269ecc05ad1459b59dd30ef0

I also checked this issue with latest C9 build i.e. https://gist.github.com/saurabh360/7c6f1da2269ecc05ad1459b59dd30ef0 and this issue is exist in this build.
Here is the Output: https://gist.github.com/saurabh360/1c9a610f5b1df87f506f927c520674cf

As per Comment #18 I have checked this issue with C8SR2 stable build i.e. Xamarin.VisualStudio_4.2.2.6_27a9b40a4ad169d5f05d2ee8b2752800b0c0f380 and the issue does not exists, as the application builds successfully.
Here is the Output: https://gist.github.com/saurabh360/f1538164d36e342cd9913a34a7e4916d

As per the comment #20 it was mentioned that the build will come out soon, so assuming that, Reopening this issue w.r.t the above observation as it is not working with the latest master and the latest Cycle 9 builds.

Please let us know the build that contains the fix for this issue, so that we  may re-test it using the same build and take this issue ahead to the closure.
Comment 23 Prashant manu 2016-12-30 08:55:00 UTC
I have checked this issue with latest C9 build i.e. Xamarin.VisualStudio_4.3.0.514_fe08ff690459c47386da7a4cb4c10b66a97378ac and now its working fine & successfully able to build the app in release mode.

Build Output: https://gist.github.com/saurabh360/5c0c6eef111fdd748bffb8b4837d7fcb
Envt Info: https://gist.github.com/sunil360/28a007aa0c3bda4da1599fb54d476f85

I also checked this issue with latest master build i.e.
Xamarin.VisualStudio_99.1.0.407_5920029f5b21f786a4a559e2681fea6f2ded40e6
and now its working fine with this also.

Supplement Info:
Screencast: https://www.screencast.com/t/KEIS8rGx7
Build Output:
https://gist.github.com/saurabh360/69b4a4e3f8764b9e79e7870d2368316a
Envt Info: https://gist.github.com/sachins360/1e0cc4c0b97e1a49cd930dc7ba3f9cd2

Hence, I am verifying this issue.

Thanks!

Note You need to log in before you can comment on or make changes to this bug.