Bug 11393 - On iPhone, debugger times out quickly
Summary: On iPhone, debugger times out quickly
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: unspecified
Hardware: Other Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2013-03-25 11:52 UTC by TotallyEvil Devs
Modified: 2013-05-09 16:42 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 TotallyEvil Devs 2013-03-25 11:52:36 UTC
Similar to #3411, when debugging on an iOS device, the debugger attaches fine, but it will timeout in about a minute if you don not continue the app execution. 

This also happens on Android.

Latest Xamarin Studio with the latest Android/iOS library extensions.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-03-25 13:44:53 UTC
Can you get the device log (Xamarin Studio's menu -> View -> Pads -> iOS Device Log) and any crash reports from Xcode's Organizer?

And exactly what do you have to do for this to happen? Is it just a matter of hitting a breakpoint and wait for a minute?
Comment 2 TotallyEvil Devs 2013-03-25 13:51:29 UTC
All I tried to do was launch the debugger on the device (Start Debugging with iOS Device target). Hit a breakpoint. Then I look at local variables, hover over variables looking at the popup window of its value. In about a minute, the debugger disconnects. If I shamrock-enter, then the debugger stays connected until the next breakpoint, then the clock resets and I have another minute to look at local variables ...

On Android, the timeout is a few seconds from what the MonoGame team has reported. Others on the team report that something similar happens on Ouya.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-04-01 07:38:14 UTC
I can't reproduce this. Jeff, can you?
Comment 4 Jeffrey Stedfast 2013-04-01 12:33:43 UTC
If your AppDelegate's FinishedLaunching() method is anywhere in the stack when your breakpoint is hit, the OS will kill your app after a short period of time.

I suspect that this is the issue you are hitting.
Comment 5 TotallyEvil Devs 2013-04-01 12:52:34 UTC
I'll give it try later. That sounds likely since most of our debugging is done during the launch of the game.
Comment 6 Mikayla Hutchinson [MSFT] 2013-04-01 15:12:57 UTC
This comes up fairly frequently so it's probably worth adding a warning at some point. Maybe whenever the app stops we could scan main thread's thread stacks for the FinishedLaunching frame, and show a warning.
Comment 7 TotallyEvil Devs 2013-04-02 13:17:59 UTC
I ran the app this time, and paused it in a place where it was hung up. Looking at code then boink! the debugger stops.

pr  2 10:14:45 the-precious-II SpringBoard[52] <Notice>: Posting 'com.apple.iokit.hid.displayStatus' notifyState=0

Apr  2 10:14:45 the-precious-II SpringBoard[52] <Notice>: MultitouchHID: detection mode: 0->255

Apr  2 10:14:46 the-precious-II UserEventAgent[12] <Warning>: DEBUG: Changing screen blanked state: 1

Apr  2 10:14:57 the-precious-II SpringBoard[52] <Warning>: cocos2dtests[18614] has active assertions beyond permitted time: 
	    <SBProcessAssertion: 0x493b30> identifier: Suspending process: cocos2dtests[18614] permittedBackgroundDuration: 10.000000 reason: suspend owner pid:52 preventSuspend  preventThrottleDownCPU  preventThrottleDownUI 

Apr  2 10:14:57 the-precious-II SpringBoard[52] <Warning>: Forcing crash report of cocos2dtests[18614]...

Apr  2 10:14:59 the-precious-II SpringBoard[52] <Warning>: Finished crash reporting.

Apr  2 10:14:59 the-precious-II com.apple.launchd[1] (UIKitApplication:cocos2d.tests[0x84c0][18614]) <Notice>: (UIKitApplication:cocos2d.tests[0x84c0]) Exited: Killed: 9

Apr  2 10:14:59 the-precious-II SpringBoard[52] <Warning>: Application 'tests' exited abnormally with signal 9: Killed: 9
Comment 8 Jeffrey Stedfast 2013-04-08 11:55:46 UTC
something killed your app with a SIGKILL, probably the OS?
Comment 9 TotallyEvil Devs 2013-04-08 12:11:33 UTC
That's the only thing that I can think of. It's like the OS thinks it's "halted" and kills it rather than letting the debugger continue.
Comment 10 Jeffrey Stedfast 2013-04-08 12:52:51 UTC
is AppDelegate.FinishedLaunching() in the stack? If so, that's probably why (that method has to return within 17 seconds or the OS will kill the app)
Comment 11 TotallyEvil Devs 2013-04-08 13:01:58 UTC
no it is not. This is after the game has launched and I just press the pause button.
Comment 12 Jeffrey Stedfast 2013-04-08 14:14:04 UTC
Comment 13 Mikayla Hutchinson [MSFT] 2013-04-08 14:17:57 UTC
Where are you putting the breakpoint? Do you have a small repro case we could try?
Comment 14 TotallyEvil Devs 2013-04-08 14:33:46 UTC
small - no. breakpoint - nowhere, I am just pausing (click pause).

This is using the cocos2d-xna project from github. We have a test project up there and just running the test app in the debugger and pausing it after launch will give me this error.
Comment 15 Jeffrey Stedfast 2013-04-10 16:41:10 UTC
This might be useful info:

Apr 10 16:29:26  kernel[0] <Debug>: ALS: AppleARMBacklight::handleMessageGated - framebufferState -> 0
Apr 10 16:29:37  backboardd[27] <Warning>: cocos2dtests[1819] has active assertions beyond permitted time: 
	    <BKProcessAssertion: 0x210a5d60> identifier: Suspending process: cocos2dtests[1819] permittedBackgroundDuration: 10.000000 reason: suspend owner pid:27 preventSuspend  preventThrottleDownCPU  preventThrottleDownUI 
Apr 10 16:29:37  backboardd[27] <Warning>: Forcing crash report of cocos2dtests[1819]...
Apr 10 16:29:38  backboardd[27] <Warning>: Finished crash reporting.

It might be that the OS is killing the app because the doTick callback for your CADisplayLink took too long to return.
Comment 16 Jeffrey Stedfast 2013-05-09 16:23:40 UTC
Did you ever figure out if the CADisplayLink callback timing out was the cause?
Comment 17 TotallyEvil Devs 2013-05-09 16:40:29 UTC
I did not, but it was the most likely cause of the problem.
Comment 18 Jeffrey Stedfast 2013-05-09 16:42:33 UTC