Bug 46164 - mono-symbolicate hard crash
Summary: mono-symbolicate hard crash
Status: RESOLVED DUPLICATE of bug 46279
Alias: None
Product: Android
Classification: Xamarin
Component: Linker (show other bugs)
Version: 7.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
: 46114 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-28 20:07 UTC by Binoy Patel
Modified: 2016-11-02 01:10 UTC (History)
7 users (show)

Tags: XATriaged
Is this bug a regression?: Yes
Last known good build: Cycle 8 – Service Release 0 (2016-10-04)


Attachments
Test project to reproduce bugs (148.69 KB, application/x-rar)
2016-10-31 18:48 UTC, Michele
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 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 DUPLICATE of bug 46279

Description Binoy Patel 2016-10-28 20:07:14 UTC
When trying to make release build of application mono-symbolicate crashes when executing following command:
"C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\com.MySampleApp.Droid.Shell.apk.mSYM" "obj\Release\android/assets"

Here is event viewer log:
Faulting application name: mono-symbolicate.exe, version: 0.0.0.0, time stamp: 0x5812341b
Faulting module name: mono-symbolicate.exe, version: 0.0.0.0, time stamp: 0x5812341b
Exception code: 0xc0000409
Fault offset: 0x00009c23
Faulting process id: 0x8bc
Faulting application start time: 0x01d23154ccef754e
Faulting application path: C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate.exe
Faulting module path: C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate.exe
Report Id: bfe44d2b-801b-4daa-8c51-570689e4b080
Faulting package full name: 
Faulting package-relative application ID: 

It doesn't even run when I simply try to run it manually using following command:
"C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate"
Same crashing when running above command in command prompt manually.

Thanks in advance,
Binoy
Comment 1 Binoy Patel 2016-10-28 20:42:27 UTC
Some more details on crashing (from output window in vs2015 update3)
* Assertion at ..\mono\metadata\class.c:5078, condition `class' not met

The command ""C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\com.MyApp.Droid.Shell.apk.mSYM" "obj\Release\android/assets"" exited with code -1073740791.
Comment 2 Graham Thomson 2016-10-31 15:20:11 UTC
I have this same problem. I believe it arrived with the update to latest Xamarin that I did last week. It is noticeable that mono-symbolicate.exe was changed on 27 October 2016.
Comment 3 Graham Thomson 2016-10-31 15:23:14 UTC
Sorry - I should have said in my first reply - since this problem is preventing distribution of new release of app and there appears to be no work-around, an importance level of "normal" may be a bit low.
Comment 4 Graham Thomson 2016-10-31 16:12:16 UTC
Just another bit of info - I tried a Rebuild and Archive of a different app that does not have any assets. That worked OK.
Further, back on original app, after the failed Build/Archive if I do Build/Clean I get:
The process cannot access the file 'Java.Interop.dll' because it is being used by another process.

Repeating Build/Clean seems to clear this.

If I do Build/Rebuild (which succeeds), then Build/Archive (which fails), then Build/Rebuild again (no Build/Clean first), I get:

The "LinkAssemblies" task failed unexpectedly.
System.IO.IOException: The process cannot access the file 'd:\Documents\Visual Studio 2015\Projects\sudokuAndv2\sudokuAndv2\obj\Release\android\assets\sudokuAndv2.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at Mono.Linker.Steps.OutputStep.CopyAssembly(FileInfo fi, String directory, Boolean symbols)
   at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	sudokuAndv2

and, again
The process cannot access the file 'Java.Interop.dll' because it is being used by another process.

I don't know if this all helps.

(You will notice the app is boring old Sudoku - being new to C#, Xamarin and Android I simply took my 10-years-old VB prog, converted to C# and then into Xamarin Android)
Comment 5 Marek Habersack 2016-10-31 16:31:06 UTC
@Binoy, @Graham, is linking enabled for the release build of the application?

Also, can you provide a small, self-contained application which would allow us to reproduce the issue locally? Thanks!
Comment 6 Michele 2016-10-31 18:47:01 UTC
Hi,
I think I have the same bug.
I'm uploading my project, it's my first one so forgive all the errors :D
Ciao,
Michele
Comment 7 Michele 2016-10-31 18:48:04 UTC
Created attachment 18279 [details]
Test project to reproduce bugs

Project to reproduce the bug
Comment 8 Marek Habersack 2016-10-31 19:09:50 UTC
@Michele, thanks for the repro!

Radek, can you check with the comment 7 test case whether it's a linker issue? If not, then it's a runtime problem, thanks!
Comment 9 Jon Douglas [MSFT] 2016-10-31 19:28:07 UTC
This seems to also happen in a File->New Blank Android App when attempting to Archive a `Release` Configuration using the Archive Manager on XVS 4.2.0.719 and XA 7.0.1.6

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
Project "App21.csproj" (PackageForAndroid target(s)):
The command ""C:\Program Files (x86)\MSBuild\Xamarin\Android\mono-symbolicate" store-symbols "bin\Release\App21.App21.apk.mSYM" "obj\Release\android/assets"" exited with code -1073740791.
Done building project "App21.csproj" -- FAILED.

Here's a full diagnostic build log as well:

https://gist.github.com/JonDouglas/2fd9b6003b1b84b44f1a8513ecb9fe24

This behavior does not exist on the latest Beta build:

XVS - 4.2.1.15

XA - 7.0.2.28
Comment 10 Michele 2016-10-31 21:31:53 UTC
Hi Jon,
How can I try with the Beta version?
Comment 11 Jon Douglas [MSFT] 2016-10-31 21:32:55 UTC
@Michele,

You can go to the Updater via:

Tools -> Options -> Xamarin -> Other (Select the Channel) and check for updates
Comment 12 Michele 2016-11-01 10:32:34 UTC
I confirm, it works properly with the Beta version!
Thanks a lot to everybody :)
Comment 13 Graham Thomson 2016-11-01 11:29:52 UTC
Following Michele's test of Beta version, I have done the same and can also confirm packaging now works OK again.
Note : before doing the Beta install mono-symbolicate.exe last modified date was 27/10/2016 and its size was 6356KB
After installing Beta, mono-symbolicate.exe last modified date is now 18/10/2016 and its size is 6446KB
Looks like a roll-back to previous version of mono-symbolicate.exe may be the simple fix here (?)
Thanks to all.
Comment 14 Jon Douglas [MSFT] 2016-11-01 20:07:37 UTC
To give a small detail of why this is happening, it's because the MSBuild property of:

<AndroidManagedSymbols>

Is by default being enabled? somehow even though it's not specified anywhere in the .csproj. The .targets would give more truth here: 

One can turn this off via adding:

<AndroidManagedSymbols>False</AndroidManagedSymbols>

To their respective `Release` configuration and this will resolve the issue in the current Stable.

This is most likely a regression caused by `mono-symbolicate` via:

https://developer.xamarin.com/releases/android/xamarin.android_6/xamarin.android_6.1/#File_name_and_line_number_information_in_release_builds

And the default behavior of this property if it's not specified.
Comment 15 Jon Douglas [MSFT] 2016-11-01 21:03:10 UTC
*** Bug 46114 has been marked as a duplicate of this bug. ***
Comment 16 Brendan Zagaeski (Xamarin Team, assistant) 2016-11-01 21:05:03 UTC
## Note to the Xamarin team

The underlying failed assertion in mono-symbolicate is presumably fundamentally a duplicate of Bug 43833.  What's really bizarre about this new bug is that based on the pattern of user reports, the default value of `<AndroidManagedSymbols>` might have changed to True in the Xcode 8.1 compatibility update so that Bug 43833 was only "silently broken" until this latest release.  This is particularly surprising because it was the _same_ Xamarin.Android 5a02b032 that was repackaged supposedly _unchanged_ into the Xamarin.VisualStudio installer for the Xcode 8.1 compatibility update [1] as was included in the original Cycle 8 – Service Release 0 [2].

[1] https://releases.xamarin.com/stable-release-cycle-8-service-release-0-w-xcode8-1-support/
[2] https://releases.xamarin.com/stable-release-cycle-8-service-release-0/
Comment 17 Brendan Zagaeski (Xamarin Team, assistant) 2016-11-02 01:10:46 UTC
## Investigation update

According to my further tests, the root of this problem is indeed the particular `mono-symbolicate.exe` binary (as suggested in Comment 13) rather than a change in the default value of `AndroidManagedSymbols`.

I was able to replicate the problem locally and carefully characterize its behavior across several versions, so I have filed a new bug to provide a detailed starting point for further investigation.  As mentioned there, my suspicion is that this problem might be related to the particular build environment (the particular computer) that was used to build this exact problematic version of the Xamarin.VisualStudio installer.

I will accordingly mark this bug as a duplicate of the new one for bookkeeping.



Best,
Brendan
Xamarin Support Team

*** This bug has been marked as a duplicate of bug 46279 ***