Bug 16424 - Debug | Stop Debugging fails to terminate application on iOS device
Summary: Debug | Stop Debugging fails to terminate application on iOS device
Status: RESOLVED INVALID
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.8.x
Hardware: PC Windows
: High normal
Target Milestone: 1.12 (Merge)
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2013-11-24 11:29 UTC by Brian
Modified: 2014-01-31 10:21 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
version info from Mac (1.28 KB, text/plain)
2013-11-24 11:29 UTC, Brian
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 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 INVALID

Description Brian 2013-11-24 11:29:33 UTC
Created attachment 5522 [details]
version info from Mac

Using version 1.8.365 of the Xamarin.iOS plugin for Visual Studio, if I debug an application on an iOS device and then select Debug | Stop Debugging in Visual Studio, the application is not terminated. I see the following in the debug output window:

  The program 'Mono' has exited with code 0 (0x0).
  The program '[6192] MedicineTracker.vshost.exe: Managed (v2.0.50727)' has exited with code -1 (0xffffffff).
  Debugging session ended.

  (then a few seconds later)

  Mono.IOS.VisualStudio.MonoTouchPackage Warning: 0 : Build server returned an Warning.
  Mono.Android.VisualStudio.MonoAndroidPackage Warning: 0 : Build server returned an Warning.
  Mono.IOS.VisualStudio.MonoTouchPackage Warning: 0 : Warning: Failed to kill application (no debug proxy found) MedicineTracker on device
  Mono.Android.VisualStudio.MonoAndroidPackage Warning: 0 : Warning: Failed to kill application (no debug proxy found) MedicineTracker on device

When I check the iPad mini, the program is still running. I have to use the task manager to kill the application.
Comment 1 Mohit Kheterpal 2013-11-26 13:09:31 UTC
This issue is duplicate of bug 13245

*** This bug has been marked as a duplicate of bug 13245 ***
Comment 2 Brian 2013-11-27 00:45:30 UTC
I watched the videocast of bug 13245. It is a different scenario than the one that I reported.

In my scenario, I wait for the application to be fully running under the debugger and even interact with the application. At a later time (doesn't matter how long), I click stop debugging. The application visually appears to close, but is still available in task manager. There are error messages in the output window complaining that Xamarin is unable to kill the application, which strongly implies that the application is really still running.

Therefore, I do not believe this is a duplicate of bug 13245, which appears to be more of a race condition caused by clicking stop debugging while a debugging session is being launched.

With that clarification, would someone from the development team please comment on the status of the bug I reported?
Comment 3 Mohit Kheterpal 2013-11-27 05:12:27 UTC
Thanks Brian.

Today I have checked this issue again as per steps mention in comment 2 and I am also getting this issue.

Debug Log : https://gist.github.com/saurabh360/820868de12028215df92
Mac server log : https://gist.github.com/saurabh360/8c61f91af7c305f654c0
Comment 4 dean.ellis 2013-11-27 06:30:56 UTC
Brian

can you post the error messages you see in the output window?

If you are referring to 

 Warning: Failed to kill application (no debug proxy found)

This is only a warning, and it is normal to see that. In most cases when you stop debugging via the stop button the debugger proxy will terminate itself. In which case this warning is raised. sometimes however the debugger proxy does not close and we send a message to kill it. This warning is just a reflection of the fact that the debugger had already terminated.

That said, on my iPad I have managed to replicate the issue where after the app is closed (or sent to the background) when I hit stop  in both Visual Studio and Xamarin Studio the application does still appear in the task manager ( double clicking the home button, or swipe up)

I'm not sure if this is expected behaviour.
Comment 5 Sebastien Pouliot 2013-12-03 08:41:33 UTC
Not sure if it's related to the original issue but to clarify some behaviours...
 
- Clicking on the home button (or using some swiping gestures to switch apps) cause the current application to be sent to the background. In such case it's normal to see the application in the task manager (i.e. that's iOS multitasking);

- The process still exists but (in most cases*) is suspended (and that kills the debugger connection). The application can be resumed (with the same PID) later if/when control is given back to it (user switch back, iOS events like background downloading completed…);

- iOS can also decide to kill suspended applications at anytime (e.g. to reclaim the memory). In such case switching back means a new instance of the application is launched;

- Applications can't be "closed", only killed : by either the debugger, a crash or iOS itself;


* there are exceptions for Apple code, VoIP apps...
Comment 6 susanta sahu 2013-12-25 09:24:04 UTC
Breakpoints: It is important to point out that the iOS gives applications only a handful of seconds (10) to startup and complete the FinishedLaunching method in the Application delegate. If the application does not complete this method in 10 seconds, the OS will kill the process.

Guys please check that your FinishedLaunching execution complets with in 6-7 seconds,
Comment 7 susanta sahu 2013-12-25 09:46:28 UTC
Run->Debug from the menu. Once the upload is complete, you will see this message: "Waiting for Debugger to connect" 

then you should manually launch the application on the device, it will connect to your Xamarin Studio and initiate debugging.

Breakpoints: It is important to point out that the iOS gives applications only a handful of seconds (10) to startup and complete the FinishedLaunching method in the Application delegate. If the application does not complete this method in 10 seconds, the OS will kill the process.

Guys please check that your FinishedLaunching execution completes with in 6-7 seconds, 

then it will start
Comment 8 dean.ellis 2014-01-31 10:21:36 UTC
I've just tested this bug with a native Obj-C XCode app. Even in Xcode when you click the Stop button the app goes into the background but is still listed in the 'Task Maanger' when you swipe up or double click home. This behaves exactly the same as Xamarin Studio and Visual Studio, so I conclude that this is the default behaviour on iOS. So resolving the issue as Invalid.