Bug 57223

Summary: Debugger does not disconnect from mac apps properly
Product: [Desktop] Xamarin Studio Reporter: James Clancey <clancey>
Component: DebuggerAssignee: David Karlaš <david.karlas>
Status: VERIFIED FIXED    
Severity: normal CC: abock, chris.hamons, mono-bugs+monodevelop, v-prala, v-prrag
Priority: Normal    
Version: 7.0 (VSforMac)   
Target Milestone: 15.3   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: CrashSample

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