Bug 155 - Lion: hang in MonoDevelop when trying to access the Project menu entry
Summary: Lion: hang in MonoDevelop when trying to access the Project menu entry
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-08-02 21:07 UTC by Miguel de Icaza [MSFT]
Modified: 2011-08-08 20:21 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 GitHub or 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 FIXED

Description Miguel de Icaza [MSFT] 2011-08-02 21:07:10 UTC
On Lion, using Mono 2.10.3, whenever I try running MonoDevelop 2.4 beta3, when I go to the "Project" menu, MD hangs.   This seems to be caused by the Android addin, disabling it fixes the problem

Since we do not have symbols, I was not able to get a stack trace that was useful, but I found this by tracing which methods were being JITed, and it hangs here:

Method MonoDevelop.Ide.Commands.SelectActiveRuntimeHandler:Update (MonoDevelop.Components.Commands.CommandArrayInfo) emitted at 0xf549380 to 0xf5494b0 (code length 304) [MonoDevelop.exe]
converting method MonoDevelop.MonoDroid.SelectDeviceTargetHandler:.ctor ()
Method MonoDevelop.MonoDroid.SelectDeviceTargetHandler:.ctor () emitted at 0xf5494c0 to 0xf5494c8 (code length 8) [MonoDevelop.exe]
converting method MonoDevelop.MonoDroid.SelectDeviceTargetHandler:Update (MonoDevelop.Components.Commands.CommandArrayInfo)
Method MonoDevelop.MonoDroid.SelectDeviceTargetHandler:Update (MonoDevelop.Components.Commands.CommandArrayInfo) emitted at 0xf5494c8 to 0xf54960a (code length 322) [MonoDevelop.exe]
converting method MonoDevelop.MonoDroid.ManageDevicesHandler:.ctor ()
Method MonoDevelop.MonoDroid.ManageDevicesHandler:.ctor () emitted at 0xf549630 to 0xf549638 (code length 8) [MonoDevelop.exe]
converting method MonoDevelop.MonoDroid.ManageDevicesHandler:Update (MonoDevelop.Components.Commands.CommandInfo)
Method MonoDevelop.MonoDroid.ManageDevicesHandler:Update (MonoDevelop.Components.Commands.CommandInfo) emitted at 0xf549638 to 0xf54966a (code length 50) [MonoDevelop.exe]
converting method MonoDevelop.MonoDroid.PublishApplicationHandler:.ctor ()
Method MonoDevelop.MonoDroid.PublishApplicationHandler:.ctor () emitted at 0xf549670 to 0xf549678 (code length 8) [MonoDevelop.exe]
converting method MonoDevelop.MonoDroid.PublishApplicationHandler:Update (MonoDevelop.Components.Commands.CommandInfo)
Method MonoDevelop.MonoDroid.PublishApplicationHandler:Update (MonoDevelop.Components.Commands.CommandInfo) emitted at 0xf549678 to 0xf549714 (code length 156) [MonoDevelop.exe]
converting method MonoDevelop.Ide.RootWorkspace:get_ActiveConfiguration ()
Method MonoDevelop.Ide.RootWorkspace:get_ActiveConfiguration () emitted at 0xf549718 to 0xf549752 (code length 58) [MonoDevelop.exe]
converting method MonoDevelop.Projects.SolutionConfigurationSelector:.ctor (string)
Method MonoDevelop.Projects.SolutionConfigurationSelector:.ctor (string) emitted at 0xf549760 to 0xf549780 (code length 32) [MonoDevelop.exe]
converting method MonoDevelop.Projects.ConfigurationSelector:.ctor ()
Method MonoDevelop.Projects.ConfigurationSelector:.ctor () emitted at 0xf549790 to 0xf549798 (code length 8) [MonoDevelop.exe]
converting method MonoDevelop.Projects.ConfigurationSelector:.cctor ()
Method MonoDevelop.Projects.ConfigurationSelector:.cctor () emitted at 0xf549798 to 0xf5497cd (code length 53) [MonoDevelop.exe]
converting method MonoDevelop.Projects.DefaultConfigurationSelector:.ctor ()
Method MonoDevelop.Projects.DefaultConfigurationSelector:.ctor () emitted at 0xf5497e0 to 0xf5497f7 (code length 23) [MonoDevelop.exe]
converting method System.IO.KeventWatcher:StopMonitoringDirectory (System.IO.KeventData)
Comment 1 Miguel de Icaza [MSFT] 2011-08-05 16:52:57 UTC
The stack trace looks like this:

MonoDevelop.MonoDroid.SelectDeviceTarget.Handler.Update

MonoDevelop.Components.Commands.CommandHandler:Update (MonoDevelop.Components.Commands.CommandInfo)

MonoDevelop.Components.Commands.CommandManager:DefaultUpdateCommandInfo (MonoDevelop.Components.Commands.ActionCommand,MonoDevelop.Components.Commands.CommandInfo)

MonoDevelop.Components.Commands.CommandManager:GetCommandInfo (object,MonoDevelop.Components.Commands.CommandTargetRoute)

MonoDevelop.Platform.Mac.OSXMenu:HandleMenuOpening (intptr,intptr,intptr)

MonoDevelop.Platform.Mac.OSXMenu:HandleMenuOpening (intptr,intptr,intptr)

The above is generating an exception:


Process 6647 stopped
* thread #1: tid = 0x2003, 0x10755c4d, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)
  frame #0: 0x10755c4d

I verified that the address 0x10755c4d is inside the managed method at the top of the stack trace, so this is a managed exception and it does not turn this into a NullReference exception.

This is on Lion.

Issuing the continue command to lldb or gdb, keeps the code in a loop, the exception continues to be delivered.
Comment 2 Miguel de Icaza [MSFT] 2011-08-05 17:06:25 UTC
More interesting details;   I started to run MonoDevelop with --trace, and MonoDevelop continues to run, at least some threads do.

The thread on the MonoDroid plugin shows that these are the methods invoked:

ENTER: MonoDevelop.MonoDroid.PublishApplicationHandler:Update (MonoDevelop.Components.Commands.CommandInfo)(this:0x9170cf8[MonoDevelop.MonoDroid.PublishApplicationHandler MonoDevelop.exe], [MonoDevelop.Components.Commands.CommandInfo:0x9b282a0], )
ENTER: MonoDevelop.MonoDroid.DefaultUploadToDeviceHandler:GetActiveExecutableMonoDroidProject ()()
LEAVE: MonoDevelop.MonoDroid.DefaultUploadToDeviceHandler:GetActiveExecutableMonoDroidProject ()[OBJECT:0x0]
ENTER: MonoDevelop.Ide.RootWorkspace:get_ActiveConfiguration ()(this:0x92c4498[MonoDevelop.Ide.RootWorkspace MonoDevelop.exe], )
ENTER: MonoDevelop.Projects.SolutionConfigurationSelector:.ctor (string)(this:0xfd34e70[MonoDevelop.Projects.SolutionConfigurationSelector MonoDevelop.exe], [STRING:null], )
ENTER: MonoDevelop.Projects.ConfigurationSelector:.cctor ()()
ENTER: MonoDevelop.Projects.DefaultConfigurationSelector:.ctor ()(this:0x9170cf0[MonoDevelop.Projects.DefaultConfigurationSelector MonoDevelop.exe], )
ENTER: MonoDevelop.Projects.ConfigurationSelector:.ctor ()(this:0x9170cf0[MonoDevelop.Projects.DefaultConfigurationSelector MonoDevelop.exe], )
LEAVE: MonoDevelop.Projects.ConfigurationSelector:.ctor ()
LEAVE: MonoDevelop.Projects.DefaultConfigurationSelector:.ctor ()
LEAVE: MonoDevelop.Projects.ConfigurationSelector:.cctor ()
ENTER: MonoDevelop.Projects.ConfigurationSelector:.ctor ()(this:0xfd34e70[MonoDevelop.Projects.SolutionConfigurationSelector MonoDevelop.exe], )
LEAVE: MonoDevelop.Projects.ConfigurationSelector:.ctor ()
LEAVE: MonoDevelop.Projects.SolutionConfigurationSelector:.ctor (string)
LEAVE: MonoDevelop.Ide.RootWorkspace:get_ActiveConfiguration ()[MonoDevelop.Projects.SolutionConfigurationSelector:0xfd34e70]

After this, MonoDevelop continues running, for the last five minutes, it shows:



LEAVE: System.Threading.Monitor:TryEnter (object,int,bool&)
LEAVE: System.Threading.Monitor:Enter (object,bool&)
ENTER: (wrapper managed-to-native) System.Threading.Monitor:Exit (object)([System.IO.KeventWatcher:0x9170d38], )
LEAVE: (wrapper managed-to-native) System.Threading.Monitor:Exit (object)
ENTER: System.Threading.Thread:Sleep (int)(500, )
ENTER: (wrapper managed-to-native) System.Threading.Thread:Sleep_internal (int)(500, )
LEAVE: (wrapper managed-to-native) System.Threading.Thread:Sleep_internal (int)
LEAVE: System.Threading.Thread:Sleep (int)
ENTER: System.Threading.Monitor:Enter (object,bool&)([System.IO.KeventWatcher:0x9170d38], [BYREF:0xb0754d1f], )
ENTER: System.Threading.Monitor:TryEnter (object,int,bool&)([System.IO.KeventWatcher:0x9170d38], -1, [BYREF:0xb0754d1f], )
ENTER: (wrapper managed-to-native) System.Threading.Monitor:try_enter_with_atomic_var (object,int,bool&)([System.IO.KeventWatcher:0x9170d38], -1, [BYREF:0xb0754d1f], )
LEAVE: (wrapper managed-to-native) System.Threading.Monitor:try_enter_with_atomic_var (object,int,bool&)
LEAVE: System.Threading.Monitor:TryEnter (object,int,bool&)
LEAVE: System.Threading.Monitor:Enter (object,bool&)
ENTER: (wrapper managed-to-native) System.Threading.Monitor:Exit (object)([System.IO.KeventWatcher:0x9170d38], )
LEAVE: (wrapper managed-to-native) System.Threading.Monitor:Exit (object)
ENTER: System.Threading.Thread:Sleep (int)(500, )
ENTER: (wrapper managed-to-native) System.Threading.Thread:Sleep_internal (int)(500, )
LEAVE: (wrapper managed-to-native) System.Threading.Thread:Sleep_internal (int)
LEAVE: System.Threading.Thread:Sleep (int)
ENTER: System.Threading.Monitor:Enter (object,bool&)([System.IO.KeventWatcher:0x9170d38], [BYREF:0xb0754d1f], )
ENTER: System.Threading.Monitor:TryEnter (object,int,bool&)([System.IO.KeventWatcher:0x9170d38], -1, [BYREF:0xb0754d1f], )
ENTER: (wrapper managed-to-native) System.Threading.Monitor:try_enter_with_atomic_var (object,int,bool&)([System.IO.KeventWatcher:0x9170d38], -1, [BYREF:0xb0754d1f], )
LEAVE: (wrapper managed-to-native) System.Threading.Monitor:try_enter_with_atomic_var (object,int,bool&)
LEAVE: System.Threading.Monitor:TryEnter (object,int,bool&)
LEAVE: System.Threading.Monitor:Enter (object,bool&)
ENTER: (wrapper managed-to-native) System.Threading.Monitor:Exit (object)([System.IO.KeventWatcher:0x9170d38], )
LEAVE: (wrapper managed-to-native) System.Threading.Monitor:Exit (object)
ENTER: System.Threading.Thread:Sleep (int)(500, )
ENTER: (wrapper managed-to-native) System.Threading.Thread:Sleep_internal (int)(500, )

Clearly from the other thread.   Every once in a while other messages are run, like the file service monitor for projects, but nothing about the SelectDeviceTargetHandler.Update method ever LEAVE-ing.
Comment 3 Miguel de Icaza [MSFT] 2011-08-05 17:09:24 UTC
We definitely have a problem with null reference checking on OSX, since running MonoDevelop from the command line like this:

MONO_DEBUG=explicit-null-checks MonoDevelop.app/Contents/MacOS/monodevelop 

Makes MonoDevelop show this popup:

System.NullReferenceException: A null value was found where an object instance was required.
  at MonoDevelop.MonoDroid.PublishApplicationHandler.Update (MonoDevelop.Components.Commands.CommandInfo info) [0x00011] in /Users/michael/Mono/md-2-6/extras/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/MonoDroidCommands.cs:223 
  at MonoDevelop.Components.Commands.CommandHandler.InternalUpdate (MonoDevelop.Components.Commands.CommandInfo info) [0x00000] in /Users/michael/Mono/md-2-6/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:47 
  at MonoDevelop.Components.Commands.CommandManager.DefaultUpdateCommandInfo (MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info) [0x00079] in /Users/michael/Mono/md-2-6/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:781 
  at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute) [0x001a9] in /Users/michael/Mono/md-2-6/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:747 

So there are two bugs: (a) the MonoDroid add-in is throwing a null-ref when there are no solutions open, and (b) the Mono runtime does not handle NullRefs on Lion.
Comment 4 Miguel de Icaza [MSFT] 2011-08-05 17:13:02 UTC
Our Mono 2.10.3 packages hang, simple test case:
mac$ cat a.cs
class X {
	static void Main ()
	{
		object o = null;

		o.ToString ();
	}
}
mac$ gmcs a.cs
mmac$ mono a.exe
* HANG *
Comment 5 Lluis Sanchez 2011-08-08 20:21:25 UTC
Fixed by the 2.10.3 update.