Bug 42643 - [AndroidPublishing] VS crashes randomly while Archiving the application.
Summary: [AndroidPublishing] VS crashes randomly while Archiving the application.
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: High major
Target Milestone: 4.2.0 (C8)
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2016-07-18 18:10 UTC by Akhilesh kumar
Modified: 2016-08-11 12:51 UTC (History)
6 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 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

Comment 2 xamarin-release-manager 2016-07-19 14:04:50 UTC
Fixed in version 99.0.0.3137 (master-publishingWorkflow)

Author: Emanuel
Commit: 85975298603ee046e994652b4909d1f773a7f713 (xamarin/XamarinVS)
Comment 9 dean.ellis 2016-07-26 08:41:29 UTC
Looks like this is a GC issue.

The crash happens when we try to add a byte[] to the zip. Because libzip only writes the file when we close, it looks like the byte[] is being GC'd before that happens. As a result when the native system tries to read the data it fails. 

A PR has been put up on LibZipSharp https://github.com/grendello/LibZipSharp/pull/18 which fixes the issue by using the streaming system which we know works well and does not have GC issues.

I'll post the git hash once that PR has been merged and the bumps have occurred in monodroid. We will also need to bump VS as well.
Comment 10 dean.ellis 2016-07-26 15:12:46 UTC
Fixed in monodroid/master/a652cebd
Comment 11 xamarin-release-manager 2016-07-26 17:14:32 UTC
Fixed in version 4.2.0.368 (cycle8)

Author: Emanuel
Commit: 85975298603ee046e994652b4909d1f773a7f713 (xamarin/XamarinVS)
Comment 12 xamarin-release-manager 2016-07-27 11:09:43 UTC
Fixed in version 4.2.0.375 (cycle8)

Author: Dean Ellis
Commit: 36daf9d3690bdbb01cc2a34129cc7550c595310a (xamarin/monodroid)
Included in Commit: 0769e3d4d6a4c8ba7ea53bd7f65af44ffc633c86 (xamarin/XamarinVS)
Comment 13 Saurabh 2016-08-01 10:13:25 UTC
I have checked this Issue with latest master build (XVS 99.0.0.3278) and latest Cycle 8 (XVS 4.2.0.399) and observed that when archive with debug mode I am getting proper error. However, In release mode application getting archived successfully even archive getting successfully canceled after clicking on cancel button.

http://www.screencast.com/t/49ke5vHwoPH

Environment Info for C8: https://gist.github.com/danish360/62be82a3267e43ee12b31af58be78f49
VS IDE Log: https://gist.github.com/danish360/59b09dd7cdb40029dc032bdf3a26416a
Comment 15 dean.ellis 2016-08-02 09:15:51 UTC
This looks like its a different error. looking at the logs I see

"MonoDroidLog Error: 0 : [2016-08-01 23:33:19.5113] [E:]:                     SignPackageAsync faulted
Xamarin.AndroidTools.AndroidSdkToolException: jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.VisualStudio.Android.Services.Publishing.AndroidToolsPublishService.<SignPackageAsync>d__8.MoveNext() in C:\Users\builder\data\lanes\3513\b5d95676\source\xamarinvs\src\Core\VisualStudio.Android\Services\Publishing\AndroidToolsPublishService.cs:line 94
MonoDroidLog Information: 0 : [2016-08-01 23:45:25.9466] [I:]:"
Comment 16 dean.ellis 2016-08-02 09:41:10 UTC
looks like that build of VS does NOT contain the fix

XamarinVS needs to be using monodroid/master/0e872cfa755630ea2b997afdb199eab99632b58f
Its currently using monodroid/master/7472cfe15a0a774f3587c053b91896a4c5dbb7ef which is 14 days old
Comment 17 Akhilesh kumar 2016-08-02 18:28:31 UTC
As the fixed is bumped in C8 build and this issue is working fine with C8 XVS builds. So I am closing this issue with C8 builds.

Environment Info for C8: https://gist.github.com/danish360/62be82a3267e43ee12b31af58be78f49

*********************************************************************

And the fixed is sill need to bumped in master build, so I am coping same issue against master. https://bugzilla.xamarin.com/show_bug.cgi?id=43006
Comment 18 xamarin-release-manager 2016-08-11 12:51:11 UTC
Fixed in version 4.2.0.457 (cycle8)

Author: Dean Ellis
Commit: 4f93312f43e53fcc6989d40fe67903da35ffc306 (xamarin/xamarin-android)
Included in Commit: 35a9aaadc062b8717790220718c840cba838d213 (xamarin/XamarinVS)