Bug 5978 - When click on Stop Debugging button in VS 2012, VS hangs.
Summary: When click on Stop Debugging button in VS 2012, VS hangs.
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: Highest blocker
Target Milestone: ---
Assignee: Vinicius Jarina
Depends on:
Reported: 2012-07-04 07:43 UTC by Nischal
Modified: 2016-08-03 15:23 UTC (History)
16 users (show)

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

Screenshot of breakpoint position (19.74 KB, image/png)
2012-07-09 07:51 UTC, Sebastian Krysmanski
Example project showing the problem (15.59 KB, application/zip)
2012-07-09 07:52 UTC, Sebastian Krysmanski

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:

Description Nischal 2012-07-04 07:43:41 UTC
Steps to reproduce:
1. Open VS 2012.
2. Create the new template application "MonoForAndroid application".
3. Debug the application.
4. After the application gets deployed successfully on device/emulator.
5. Click on the Stop Debugging button.
6. Observe that the VS hangs.

Actual result: After debugging the application on device/emulator through VS 2012, when click on the "Stop Debugging" button, VS 2012 hangs.

Expected result: After debugging the application on device/emulator through VS 2012, when click on the "Stop Debugging" button, it should stop the debugging of the application and VS should not hang.

Environment information:
Windows 7 and Windows 8
VS 2012
MFA 4.2.4 RC3

Regression status: Not a Regression, as the issue also exists with MD Stable and MFA 4.2.3 Stable installed.

So it seems that the issue is with VS 2012 

Note: This issue does not exists with VS 2010.
Comment 1 Sebastian Krysmanski 2012-07-09 07:50:32 UTC
This issue exists for me in Visual Studio 2010.

I've attached an example project and a screenshot. If you set a breakpoint at this line (38), get there and then hit the "Stop" button the debugger will hang (for 10 seconds or so).

On logcat I get:

The program 'Mono' has exited with code 255 (0xff).
07-09 13:48:15.933 I/dalvikvm( 1785): threadid=3: reacting to signal 3
07-09 13:48:15.937 I/dalvikvm( 1785): Wrote stack traces to '/data/anr/traces.txt'
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

I'm testing with a Nexus S running Android 4.0.4, Visual Studio 2010 and MfA 4.2.3.
Comment 2 Sebastian Krysmanski 2012-07-09 07:51:58 UTC
Created attachment 2177 [details]
Screenshot of breakpoint position
Comment 3 Sebastian Krysmanski 2012-07-09 07:52:30 UTC
Created attachment 2178 [details]
Example project showing the problem
Comment 4 Tracy 2012-07-26 23:06:53 UTC
I do get occasional 15-20 second delays when hitting the stop button in VS 2010, but it will always resume after that.
On a second machine running VS 2012 it hangs and has to be forcibly shut down when you hit the stop button. This happens both when using an emulator or a phone.

This is a show stopping bug in VS 2012.
Comment 5 Stephan Desmoulin 2012-07-31 12:41:08 UTC
I can confirm that I am also experiencing this bug with Visual Studio 2012 Ultimate Edition on Windows 7 x64 with SP1 and Mono for Android 4.2.5.
Comment 6 Tracy 2012-08-11 13:23:35 UTC
Its been over a month since this bug was listed.
VS 2012 is getting very close to launch.
I know I will be using it over VS 2010 for most everything.
Can we really not get even a acknowledgement that the bug exists and it is being worked on?
We have paid $1000 for this product and love it, but need to make sure that it will work with VS 2012.
Comment 7 PJ 2012-08-11 14:32:23 UTC
Any progress on this bug? Tracy is right, we need to get this fixed ASAP.

Increasing severity/priority to account for the imminent release of VS2012.
Comment 8 Dominique Louis 2012-08-12 08:57:56 UTC
Adrian from Clarius is looking into this issue. I'm awaiting an update. Hopefully I'll have one by Tuesday.
Comment 9 Simon Cropp 2012-08-20 23:35:18 UTC
Any update on this?
Comment 10 Dominique Louis 2012-08-21 04:18:54 UTC
Hi Simon,
  We have an internal fix for this. Assuming it passes QA, it should be part of the next release.

Comment 11 Sebastian Krysmanski 2012-09-03 10:17:05 UTC
Is this fix included in the most recent MfA 4.2.5 beta? Because I'm still seeing this (on VS 2010).
Comment 12 Nischal 2012-09-03 11:28:43 UTC
Today, when we verified this issue with the latest version of MFA:

MFA - fbf243f0da2f31323cf1b8216df8d3c774be0c26

Now, this issue does not exist.
Comment 13 Sebastian Krysmanski 2012-09-04 03:46:02 UTC
Not sure where I can see the last part of the version (i.e. the part after "4.2.5"). So, is this the public beta version you're referring to? And do I understand you correctly that this issue doesn't exist (for you) anymore?
Comment 14 Jonathan Pryor 2012-09-04 12:03:56 UTC
Comment seen on #monodroid (IRC) about the 4.2.5 beta (which has a fix for this issue):

> I can still hang it up if I set a break point, step to next line, then hit shift-F5 to stop.  
> 2012 and my phone are locked up.
> took 2012 about 90 seconds to come back.
> well, I can kill the process on my phone it seems and 2012 comes back.  not optimal, but at least a work around.
Comment 15 PJ 2012-09-04 14:08:15 UTC
The total freeze for VS2012 seems fixed (as was present in 4.2.4) in my personal testing, but there is still a long delay when stopping debugging on both VS2012 and VS2010.

Sebastien I am filing your issue separately as bug 6899. I've assigned Dominique and have CCed you on it.

Comment 14 still needs investigation as it pertains to this bug (total VS2012 freeze).
Comment 16 Goncalo Oliveira 2012-11-21 09:39:29 UTC
Not sure if connected, but I'm getting occasional freezes after deploying an application to a device.

VS 2012
MFA 4.4.5
Comment 17 Anatoly 2013-01-17 05:08:50 UTC
This bug is strongly related with adb.exe. If connection with device will be reestablished or adb.exe will be restarted then VS 2012 unfreezes.

VS 2012
MFA 4.4.54
Comment 18 Matthew Sanders 2013-01-27 21:59:35 UTC
I can confirm that on VS 2012 I also get this error (Visual Studio very slow/locks up and chewing up 100% CPU on one core.), and if I kill the adb.exe process the CPU usage drop to 0% again.  ADB is not using any CPU.

It feels like the issue is with Visual Studio hard polling std-out or std-err of he ADB app, or similar.  But hey, what would I know :-)

Happy bug hunting.
Comment 19 PJ 2013-05-23 16:13:18 UTC
I haven't been able to reproduce this issue since the fall.

I was concerned about comment 14, and comment 17 and comment 18 are not good signs that the whole issue is completely eradicated.

That being said, without being able to reproduce it myself and without further info, we can't really proceed. I'm going to mark this bug as RESOLVED FIXED, as at least the initial issue is definitely gone.

If anyone is still seeing a hang when stopping debugging, please open a new bug and provide all relevant logs, version information, and steps.

Thank you!
Comment 20 Nischal 2013-05-24 03:58:46 UTC
Today we have checked this issue with following build:

VS 2012/2010
Xamarin.Android 4.6.7-4
iOS for VS 1.1.200

When we click on stop debugging button, Application get stopped successfully it does not take time to stop.

Changing the status to Verified.