Bug 1734 - crash while refreshing devices
Summary: crash while refreshing devices
Status: CLOSED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 2.8.1
Hardware: PC All
: High normal
Target Milestone: ---
Assignee: shana@xamarin.com
URL:
: 2561 ()
Depends on:
Blocks:
 
Reported: 2011-10-27 14:50 UTC by Sebastien Pouliot
Modified: 2012-03-20 18:53 UTC (History)
5 users (show)

Tags:
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:
Status:
CLOSED FIXED

Description Sebastien Pouliot 2011-10-27 14:50:06 UTC
I clicked on "Run", "Run" and got the device/emulator dialog.

From there I could see both my emulator and Nexus S phone. Curiously I clicked "Refresh" and _lost_ my phone. A few more clicks _lost_ the simulator and another one crashed MonoDevelop.

M4A 1.9.2 on Mac OSX Lion
Comment 1 Sebastien Pouliot 2011-10-28 18:33:39 UTC
It happening again (after mba came out of sleep) and this time I got an MD dialog to show me the exception:

System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.MonoDroid.AdbStartServerProcess.CaptureOutput () [0x00099] in /private/tmp/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/Adb/DeviceManager.cs:446 
  at System.Threading.Thread.StartUnsafe () [0x00016] in /private/tmp/monobuild/build/BUILD/mono-2.10.6/mcs/class/corlib/System.Threading/Thread.cs:680
Comment 2 PJ 2012-01-06 16:46:18 UTC
*** Bug 2561 has been marked as a duplicate of this bug. ***
Comment 3 PJ 2012-01-06 16:58:09 UTC
Confirmed on:

MonoforAndroid 4.0.1
Monodevelop 2.8.5.1
Mono 2.10.8
Windows 7 SP1

Unhandled exception after refreshing devices a number of times. 

System.NullReferenceException: Object reference not set to an instance of an
object.

   at MonoDevelop.MonoDroid.AdbStartServerProcess.CaptureOutput()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state, Boolean ignoreSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)

   at System.Threading.ThreadHelper.ThreadStart()


Windows Error Msg:

Problem signature:
  Problem Event Name:    CLR20r3
  Problem Signature 01:    monodevelop.exe
  Problem Signature 02:    2.6.0.0
  Problem Signature 03:    4f038baf
  Problem Signature 04:    MonoDevelop.MonoDroid
  Problem Signature 05:    4.0.0.24
  Problem Signature 06:    4f038c2d
  Problem Signature 07:    1df
  Problem Signature 08:    a5
  Problem Signature 09:    System.NullReferenceException
  OS Version:    6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1:    0a9e
  Additional Information 2:    0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:    0a9e
  Additional Information 4:    0a9e372d3b4ad19135b953a78882e789

Also brought in duplicate bug from MacOSX so making this a multi-platform bug.
Comment 5 PJ 2012-02-22 15:21:35 UTC
I just reproduced this behavior on Mondevelop 2.8.8.0

Refreshing the device list repeatedly first results in this MonoDevelop output:

https://gist.github.com/a8e6e6bf7e4173714caf


Continuing to do this results in a crash:

https://gist.github.com/1886949
Comment 6 Alan McGovern 2012-03-02 12:14:16 UTC
I've just debugged the issue in the second gist  (https://gist.github.com/1886949) with Rodrigo and the consensus is it's a race condition between a thread abort and a null dereference. We have a workaround which is being committed to mono which should resolve the native crash permanently. I'll investigate the managed null reference exception (https://gist.github.com/a8e6e6bf7e4173714caf) now and try to get that resolved too.
Comment 7 Alan McGovern 2012-03-02 13:05:07 UTC
I think this one has been well and truly fixed now. We had missed a spot before which could still result in that null reference exception happening. I just pushed the fix for it and can verify that constant clicking on 'Refresh' does not crash MD for me anymore. Will backport it to 2.8.8-series now.
Comment 9 Alan McGovern 2012-03-20 10:46:59 UTC
Apparently the patch fixing this did not get backported from the 2-10 branch to the place where the latest 2.10.9 release came from. The commit in question is '02a2af110f4a0ffc77d75ea658baa6ddd2f5a6de'. We need a mono release with that patch in order to fix this issue for sure.
Comment 10 PJ 2012-03-20 18:53:06 UTC
I verified this fix on Mono 2.10.9 revision 8 using MD2.8.8.1 and MfA4.0.6

I can no longer crash MonoDevelop with repeated clicking of the button, although I can still get it into a non-refreshing state with an *excessive* number of rapid clicks (100).  

Change is live so I will close the bug.