Bug 27544 - Application gets crashed on device/emulator in release mode
Summary: Application gets crashed on device/emulator in release mode
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.0
Hardware: PC All
: Normal normal
Target Milestone: 6.1 (C7)
Assignee: dean.ellis
Depends on:
Reported: 2015-03-02 05:36 UTC by Arpit Jha
Modified: 2015-11-18 10:23 UTC (History)
3 users (show)

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:

Description Arpit Jha 2015-03-02 05:36:14 UTC
Steps to reproduce:
1.Create a Xamarin.Android application.
2.Run the application on device/emulator in Debug mode.
3.Observed that application gets successfully deployed.
4.Stop the running application.
5.Now Run the application on device/emulator in release mode.

Actual Result: If we first debug/run the application and then run it in release mode, it gets crashed.

Note: If we create and run app directly in release mode, it runs successfully.

Expected Result: Application should deployed successfully on device/emulator in release mode.

Supplementary Info: 

XAP device logs: https://gist.github.com/Arpit360/b41cab5d90418cb91a7f
adb logcat: https://gist.github.com/anonymous/ea90e7362ea80c240814
Ide log: https://gist.github.com/Arpit360/0be745c4f1e64e60440d
Screencast: http://www.screencast.com/t/vYgLZBHE

Regression Status: This issue is also exist with XS 5.8(build 989) and XA 5.0.99.

Note: This issue is also exist on Mac.

Environment Info: 

=== Xamarin Studio ===

Version 5.8 (build 1041)
Installation UUID: a0cab582-25eb-47fe-aa4a-c41ae667ad31
	Microsoft .NET 4.0.30319.34003
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 5.0.99 (Enterprise Edition)
Android SDK: D:\android-sdk
	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: C:\Program Files\Java\jdk1.7.0_67
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: 0.1.1
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 508001041
Git revision: fb49f5b17bced266244831c07c28f9fc93915cb1
Build date: 2015-02-27 10:48:51-05
Xamarin addins: e88a2212bb7156a42ad6728b82e99846c3eea817

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 1 Peter Collins 2015-09-01 12:21:48 UTC
I was able to reproduce a similar failure on a Nexus 5 with M Preview 3 (6.0) device:
> E mono   : The assembly mscorlib.dll was not found or could not be loaded.

I was able to reproduce this with C5SR4 builds when deploying from XS first in debug, and then switching and deploying in release. I was _unable_ to reproduce using the same steps on a Nexus 7 with 4.4.4. 

Comment 3 dean.ellis 2015-10-23 08:33:49 UTC
@peterc do you get the architecture not supported issue (in a previous build) when it doesn't work for you?
Comment 4 Peter Collins 2015-10-23 10:22:39 UTC
@Dean - I wasn't seeing that error for this test case (immediately switching from a debug deployment  to release).
Comment 5 dean.ellis 2015-10-23 10:29:37 UTC
I'm having trouble replicating this.

Can some someone who can, please try the following from a terminal/command prompt

msbuild/xbuild <project> /t:Install /p:Configuration=Debug


msbuild/xbuild <project> /t:Install /p:Configuration=Release > build.log

obviously use msbuild or xbuild depending on windows or mac and see 

a) if we get the same issue
b) provide the build.log which should include all the deployment information.

if possible the contents of the .apk in bin\Release would be helpful too.
Comment 6 Peter Collins 2015-10-23 15:28:49 UTC
This issue is very finicky. I can't seem to reliably reproduce this on cycle6 builds. I am able to reproduce something similar however, if I deploy in debug, then switch to release, then switch _back_ to debug, but it appears to be debugger related. I can't reproduce from command line using /t:Install + /t:_Run.

@Arpit can you take another look at this with cycle 6 builds, and if you're able to reproduce reliably also attempt what Dean has mentioned in Comment #5?
Comment 7 dean.ellis 2015-11-03 06:37:32 UTC
@peter @arpit any update on this issue?
Comment 8 Arpit Jha 2015-11-03 09:42:41 UTC
I have checked this issue with latest Cycle 6 build on windows and mac machine and observed that App does not crash when first deploy app on device  in debug then Release configuration or  vice versa.

Mac Machine :
Output : 
 On running xbuild <project> /t:Install /p:Configuration=Debug https://gist.github.com/Arpit360/e203102e31406cda4c6b
On running xbuild <project> /t:Install /p:Configuration=Release : https://gist.github.com/Arpit360/9b4f100e83fd1e285526

Windows Machine: 
C:\Windows\Microsoft. NET\Framework\v4.0.30319\MSBuild.exe App42\App42.csproj /t:Install /p:Configura tion=Debug https://gist.github.com/Arpit360/6576f398f40b09ab7937
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe App42\App42.csproj /t:Install /p:Configuration=Release  :  https://gist.github.com/Arpit360/629525b272ea185a7a17

Observation: All the above command is install app on device successfully.
I have checked the same with XS and VS IDE and observed that this issue is working fine App does not crash at the time of launch on device when first deploy on device in debug then in Release or vice versa.

Please suggest, As per my understanding we should close the bug as we are not reproducible with latest Cycle 6 build .

Screencast : http://www.screencast.com/t/JrBPnqB2
Environment Info:
Device: Moto G (Android 5.1.1)
Mac machine : https://gist.github.com/Arpit360/123003ba8706db7f4328
Windows Machine : https://gist.github.com/Arpit360/8ea93952f0fc01e46385
Comment 9 Arpit Jha 2015-11-03 23:31:28 UTC
@dean ,@peter Please add your suggestion :

As we are not reproducible with latest Cycle 6 build in comment 8
Comment 10 Peter Collins 2015-11-18 10:23:03 UTC
Marking as not reproducible based on Comment 6 and Comment 8.