Bug 57223 - Debugger does not disconnect from mac apps properly
Summary: Debugger does not disconnect from mac apps properly
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger (show other bugs)
Version: 7.0 (VSforMac)
Hardware: PC Mac OS
: Normal normal
Target Milestone: 15.3
Assignee: David Karlaš
URL:
Depends on:
Blocks:
 
Reported: 2017-06-07 03:28 UTC by James Clancey
Modified: 2017-07-20 12:11 UTC (History)
5 users (show)

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


Attachments
CrashSample (347.50 KB, application/zip)
2017-06-07 03:28 UTC, James Clancey
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 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:
Status:
VERIFIED FIXED

Description James Clancey 2017-06-07 03:28:43 UTC
Created attachment 22728 [details]
CrashSample

When I stop debugging the attached sample, the app crashes and the OS gives me an error asking if I want to ignore or reopen.

Also when I run the gMusic for mac, and stop debugging. The app locks up and never closes:
https://github.com/clancey/gmusic
Comment 1 David Karlaš 2017-06-07 16:11:31 UTC
Here are 2 problems reported...
1) Crashing
2) Hanging

I was not able to reproduce crash with attached project... Can you copy paste About information in Visual Studio for Mac?(probably I need specific version of XM)

I was able to reproduce Hanging by gMusic and "fixed" in in IDE by ForceTerminating process: https://github.com/mono/monodevelop/pull/2581

Actual fix needs to be done by Xamarin.Mac or Mono to close application when VM_EXIT is called(https://github.com/mono/mono/blob/master/mono/mini/debugger-agent.c#L7422)
Comment 2 Aaron Bockover [MSFT] 2017-06-07 19:35:23 UTC
We run into this constantly when working on Workbooks & Inspector.

It's possible that the CMD_VM_EXIT path in the debugger is calling managed Environment.Exit (if TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT is set), in which case, the actual culprit for this bug may be #52604.

I attached a simple repro case to that bug.
Comment 3 Aaron Bockover [MSFT] 2017-06-07 19:42:10 UTC
For those that speak in URIs: https://bugzilla.xamarin.com/show_bug.cgi?id=52604

I highly suspect that's the root cause of this issue, although I also think the PR in comment #1 is correct (a method called "KillProcess" probably does want to send SIGKILL 
 (ForceTerminate) and not SIGTERM (Terminate)).
Comment 4 xamarin-release-manager 2017-06-09 12:11:44 UTC
Fixed in version 7.2.0.96 (master)

Author: David Karla??
Commit: 42646517660a5a6ebb04086bf271cbb6197b7a70 (mono/monodevelop)
Comment 5 xamarin-release-manager 2017-06-09 13:43:29 UTC
Fixed in version 7.1.0.1174 (d15-3)

Author: Lluis Sanchez
Commit: dac776e0d941c9a00c711e82eaa2a390155db885 (mono/monodevelop)
Comment 8 David Karlaš 2017-06-28 07:15:52 UTC
This bug reported 2 bugs.
1) Crashing
2) Hanging

Crashing is bug in runtime and is reported as  https://bugzilla.xamarin.com/show_bug.cgi?id=52604 other bug Hanging is fixed with this bug. So test if applications are closed after debugging is stopped, crashing and report windows are not fixed with this bug since it's runtime bug.
Comment 9 Prasad Raghorte 2017-07-20 12:11:42 UTC
As per above comment I have checked this with d15.3 build and debugger is able to disconnect from Mac application. Hence marking this as verified.

Build info: https://gist.github.com/raghorteprasad/d1bd993f287b2b06e49be1263e97a74a