Bug 2945 - Emulator: Debugger disconnects silently and app exits
Summary: Emulator: Debugger disconnects silently and app exits
Status: RESOLVED DUPLICATE of bug 4725
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 4.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-01-17 15:57 UTC by Paul DB
Modified: 2012-06-14 20:02 UTC (History)
4 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 Paul DB 2012-01-17 15:57:40 UTC
Running MfA 4.0.3 beta, but had same problem in 4.0.1.
Using emulator - Android 2.3 image with WVGA 800 res, 500MB SD.

I have a login activity that is fairly process intensive (creates a new sqlite db and does some field encryption).  
The intensive stuff is not running on the UI thread (using ThreadPool.QueueUserWorkItem to offload).

Debugger disconnects without any errors in the Device Logging and the app exits on the emulator.
The only message I get is below, shows in the Debug output in VS:

The program 'Mono' has exited with code 255 (0xff).

If I run the app directly on the emulator without debugging, it runs fine.
Comment 1 Paul DB 2012-01-17 16:24:45 UTC
Here's the Device Log, though I can't see anything obvious in terms of exceptions.

I can put together a demo project if needed.

01-18 07:21:37.080 I/monodroid-gc(  503): environment supports jni NewWeakGlobalRef
01-18 07:21:41.366 I/ActivityManager(   62): Starting: Intent { cmp=tapto.tapto/tapto.droid.activities.LoginActivity } from pid 503
01-18 07:21:41.456 D/dalvikvm(  503): GC_EXTERNAL_ALLOC freed 58K, 53% free 2566K/5379K, external 1625K/2137K, paused 61ms
01-18 07:21:41.716 D/dalvikvm(  503): GC_EXTERNAL_ALLOC freed 1K, 53% free 2566K/5379K, external 3125K/3903K, paused 38ms
01-18 07:21:41.886 W/ActivityManager(   62): Activity pause timeout for HistoryRecord{4075ef90 tapto.tapto/tapto.droid.activities.StartupActivity}
01-18 07:21:42.356 D/dalvikvm(  503): GC_EXTERNAL_ALLOC freed 2K, 53% free 2581K/5379K, external 4059K/4813K, paused 46ms
01-18 07:21:43.437 W/ActivityManager(   62): Launch timeout has expired, giving up wake lock!
01-18 07:21:43.915 W/ActivityManager(   62): Activity idle timeout for HistoryRecord{4075ef90 tapto.tapto/tapto.droid.activities.StartupActivity}
01-18 07:21:44.825 I/ActivityManager(   62): Displayed tapto.tapto/tapto.droid.activities.LoginActivity: +2s941ms (total +11s398ms)
01-18 07:21:50.455 D/dalvikvm(  133): GC_EXPLICIT freed 24K, 51% free 2903K/5831K, external 4623K/5293K, paused 67ms
01-18 07:22:25.206 D/dalvikvm(  117): GC_EXTERNAL_ALLOC freed 70K, 49% free 3189K/6215K, external 2107K/2137K, paused 50ms
01-18 07:22:25.586 D/dalvikvm(  117): GC_EXTERNAL_ALLOC freed 63K, 47% free 3295K/6215K, external 2670K/2680K, paused 53ms
01-18 07:22:25.796 D/dalvikvm(  117): GC_EXTERNAL_ALLOC freed 13K, 47% free 3302K/6215K, external 3364K/3373K, paused 59ms
01-18 07:22:26.076 D/dalvikvm(  117): GC_EXTERNAL_ALLOC freed 15K, 47% free 3330K/6215K, external 4243K/4254K, paused 49ms
01-18 07:22:26.586 W/KeyCharacterMap(  117): No keyboard for id 0
01-18 07:22:26.595 W/KeyCharacterMap(  117): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-18 07:22:26.816 D/dalvikvm(  117): GC_EXTERNAL_ALLOC freed 77K, 45% free 3464K/6215K, external 5273K/5338K, paused 63ms
01-18 07:22:26.946 W/KeyCharacterMap(  117): No keyboard for id 0
01-18 07:22:26.946 W/KeyCharacterMap(  117): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-18 07:22:30.835 W/KeyCharacterMap(  503): No keyboard for id 0
01-18 07:22:30.835 W/KeyCharacterMap(  503): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-18 07:22:32.465 D/dalvikvm(  117): GC_CONCURRENT freed 476K, 47% free 3517K/6599K, external 6386K/7268K, paused 18ms+4ms
01-18 07:22:32.625 W/KeyCharacterMap(  117): No keyboard for id 0
01-18 07:22:32.625 W/KeyCharacterMap(  117): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-18 07:22:39.025 D/dalvikvm(  503): GREF has increased to 201
01-18 07:22:46.205 D/dalvikvm(  503): GC_EXPLICIT freed 128K, 52% free 2658K/5447K, external 5398K/6234K, paused 42ms
01-18 07:22:46.215 I/monodroid-gc(  503): GC cleanup summary: 16 objects tested - resurrecting 13.
01-18 07:23:00.996 I/ActivityManager(   62): Starting: Intent { cmp=tapto.tapto/tapto.droid.activities.DashboardActivity } from pid 503
01-18 07:23:01.196 W/InputManagerService(   62): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40608230
01-18 07:23:01.426 D/dalvikvm(  503): threadid=10: thread exiting, not yet detached (count=0)
01-18 07:23:02.246 D/AndroidRuntime(  520): 
01-18 07:23:02.246 D/AndroidRuntime(  520): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
01-18 07:23:02.256 D/AndroidRuntime(  520): CheckJNI is ON
01-18 07:23:03.316 D/AndroidRuntime(  520): Calling main entry com.android.commands.am.Am
01-18 07:23:03.916 I/ActivityManager(   62): Displayed tapto.tapto/tapto.droid.activities.DashboardActivity: +2s829ms
01-18 07:23:03.926 D/Zygote  (   33): Process 503 exited cleanly (255)
01-18 07:23:03.926 I/ActivityManager(   62): Process tapto.tapto (pid 503) has died.
01-18 07:23:03.956 E/InputDispatcher(   62): channel '4066e440 tapto.tapto/tapto.droid.activities.LoginActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
01-18 07:23:03.956 E/InputDispatcher(   62): channel '4066e440 tapto.tapto/tapto.droid.activities.LoginActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
01-18 07:23:03.976 I/WindowManager(   62): WIN DEATH: Window{4066e440 tapto.tapto/tapto.droid.activities.LoginActivity paused=true}
01-18 07:23:04.006 I/WindowManager(   62): WIN DEATH: Window{406bcf58 tapto.tapto/tapto.droid.activities.DashboardActivity paused=false}
01-18 07:23:04.016 E/InputDispatcher(   62): Received spurious receive callback for unknown input channel.  fd=167, events=0x8
01-18 07:23:04.125 D/AndroidRuntime(  520): Shutting down VM
01-18 07:23:04.146 D/dalvikvm(  520): GC_CONCURRENT freed 101K, 69% free 319K/1024K, external 0K/0K, paused 1ms+1ms
01-18 07:23:04.146 D/jdwp    (  520): adbd disconnected
01-18 07:23:04.166 I/dalvikvm(  520): JNI: AttachCurrentThread (from ???.???)
01-18 07:23:04.166 I/AndroidRuntime(  520): NOTE: attach of thread 'Binder Thread #3' failed
01-18 07:23:04.256 W/InputManagerService(   62): Got RemoteException sending setActive(false) notification to pid 503 uid 10036
01-18 07:23:05.798 W/InputConnectionWrapper.ICC(  117): Timed out waiting on IInputContextCallback
Comment 2 Miguel de Icaza [MSFT] 2012-01-18 00:29:17 UTC
Does this happen with other sample programs, or only for this scenario with the slow startup?
Comment 3 Jonathan Pobst 2012-01-18 00:30:25 UTC
If you are able to provide a demo project, that would help tremendously!

I don't see anything in the log, so there isn't much to go on without a test case.
Comment 4 Paul DB 2012-01-18 00:55:58 UTC
I can't comment on other sample programs, since I'm working primarily on my own app.  If you have any specific sample programs you would like me to try, I'd be happy to do so.

I'll create a demo project tonight, will take a bit of time to strip out extraneous code.
Comment 5 Paul DB 2012-01-18 08:40:29 UTC
Just spent some time putting together a demo project.  At first I was able to duplicate the issue, however now I cannot.  What's more if I run the original project - the one that initiated this bug - I cannot duplicate the issue there either :(

Really not sure what has changed.  Have tried a few things like restarting the emulator to figure out how to duplicate.

All I know is this issue was plaguing me this morning and is now not happening this evening.

Can we put this issue on hold until the issue comes back and I can get a handle on how to consistently duplicate it?
Comment 7 Paul DB 2012-01-20 05:32:40 UTC
The issue came back last night, so I tried a bit more to duplicate with a demo project.  Have attached one that consistently gets the Monodroid debugger to exit.

Details to duplicate as follows:

1. Use VS 2010
2. Run against Android emulator.  I used Android 2.3, WVGA800, SD card = 500MB.
3. Enter First Name, Surname and a password.
4. Should get "Running first time setup" dialog.
5. Debugger exits in VS without any exception in device log.
6. App closes in emulator.

I running a boot camped Windows 7 on Macbook Air 2011, 1.7ghz CPU, 4GB RAM, 128GB hdd.

Given the difficulty in duplicating, the demo project is a stripped down version of my app.  Appreciate it if you don't distribute too widely and also don't laugh too hard at the code - its my first Monodroid app ;)
Comment 8 Mike 2012-06-13 16:14:38 UTC
This sounds suspiciously like the same thing I'm getting - see bug 5619. But caused maybe by different things? Maybe?
Comment 9 Jonathan Pobst 2012-06-13 16:17:35 UTC
@Mike, you can try running your app without the debugger (Ctrl-F5) and see if it still crashes.  If it doesn't, it's likely the same issue.
Comment 10 Mike 2012-06-13 16:28:36 UTC
@Jonathan, tried it, still crashes sadly. lol, on the more optimistic side, it's now 100% reproducible on my side :)
Comment 11 Jonathan Pobst 2012-06-14 20:02:49 UTC
I am pretty sure this is the same as 4725, which is fixed for 4.2.4.

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