Bug 11637 - Randomly becomes impossible to debug on iPhone Simulator or Device
Summary: Randomly becomes impossible to debug on iPhone Simulator or Device
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-04-07 14:58 UTC by Rhys
Modified: 2013-12-05 18:34 UTC (History)
5 users (show)

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:

Description Rhys 2013-04-07 14:58:38 UTC
Xamarin gets itself into a state where installing an app to the simulator results in the error 'Cannot Execute' with the rest of the error cut off. There are no logs anywhere, so it's impossible to find out what's going on.

Furthermore, when in this state Xamarin also randomly fails to both deploy to the device, and actually -connect- to the running application. Sometimes it even fails to register breakpoints, or prevents you adding/removing them in the UI.

This is extremely frustrating, it went away randomly a while ago and now it's back again in full force.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-04-08 17:52:55 UTC
Does any of the following help when this happens:
* Restart Xamarin Studio
* Restart the device.
* Restart your Mac.

And could you do the following which will provide more information when it occurs again:
* Go to the project's iOS Build options and add "-v -v -v" (without the quotes) to the additional mtouch arguments.
* Next time the debugger won't connect, get anything printed to the Application Output in Xamarin Studio and the output in the device log (Xamarin's menu: View -> Pads -> iOS Device Log) Note that you do not have to keep the device log open all the time, some history will be printed when you connect.
Comment 2 Jason Smith [MSFT] 2013-04-08 19:57:49 UTC
Error I get in the logs when experiencing this issue:

ERROR [2013-04-08 16:48:47Z]: Cannot execute "/Users/jasonsmith/Sources/TravelPlanner/src/TravelPlanner.iOS/bin/iPhoneSimulator/Debug/Hotwire.exe"
System.Net.Sockets.SocketException: Address already in use
  at System.Net.Sockets.Socket.Bind (System.Net.EndPoint local_end) [0x0006c] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/System/System.Net.Sockets/Socket.cs:1130 
  at MonoDevelop.IPhone.IPhoneTcpCommandConnection..ctor (System.Net.IPAddress ipAddress, Int32 port) [0x00036] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Execution/IPhoneCommandConnection.cs:482 
  at MonoDevelop.IPhone.IPhoneExecutionHandler.CreateCommandConnection (MonoDevelop.IPhone.IPhoneDevice device) [0x0000b] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/md-addins/MonoDevelop.IPhone/MonoDevelop.IPhone/Execution/IPhoneExecutionHandler.cs:341 
  at MonoDevelop.Debugger.Soft.IPhone.IPhoneSoftDebuggerEngine.CreateDebuggerStartInfo (MonoDevelop.Core.Execution.ExecutionCommand command) [0x00038] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/md-addins/MonoDevelop.IPhone/MonoDevelop.Debugger.Soft.IPhone/IPhoneSoftDebuggerEngine.cs:58 
  at MonoDevelop.Debugger.DebuggerEngine.CreateDebuggerStartInfo (MonoDevelop.Core.Execution.ExecutionCommand cmd) [0x00006] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs:82 
  at MonoDevelop.Debugger.DebuggingService.InternalRun (MonoDevelop.Core.Execution.ExecutionCommand cmd, MonoDevelop.Debugger.DebuggerEngine factory, IConsole c) [0x0003a] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs:523 
  at MonoDevelop.Debugger.DebugExecutionHandler.Execute (MonoDevelop.Core.Execution.ExecutionCommand command, IConsole console) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs:70 
  at MonoDevelop.Debugger.DebugExecutionHandlerFactory.Execute (MonoDevelop.Core.Execution.ExecutionCommand command, IConsole console) [0x00015] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs:52 
  at MonoDevelop.Projects.DotNetProject.DoExecute (IProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration) [0x000ca] in /Users/builder/data/lanes/monodevelop-lion-bs1/fae7c2bd/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1145
Comment 3 Rhys 2013-04-09 01:24:54 UTC
Restarting the app doesn't fix the issue
Restarting the device doesn't fix the issue
Restarting my computer doesn't immediately fix the issue, I usually have to wait until the next day before it works again

I should note this has been happening for about 4 months, so this bug is irrespective of IDE version. Even the latest alpha doesn't fix it.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-04-09 07:06:58 UTC
Rhys: can you attach the Ide.* log files from /Users/<username>/Library/Logs/XamarinStudio-4.0/ in addition to adding the diagnostic output to your project.
Comment 5 Rhys 2013-04-13 12:24:54 UTC
Even with -v -v -v I get no useful output from build:

---------------------- Done ----------------------

Build successful.

I've tried adding in both Compiler - Additional arguments and iOS Build - additional mtouch arguments. Neither provides anything more than that.

I've attached the requested files.
Comment 7 Rhys 2013-04-13 12:28:37 UTC
I've checked what ports are being listened by what executables, the only one relevant to MonoTouch was the Xamarin IDE. Killing and restarting didn't fix anything.
Comment 8 Rolf Bjarne Kvinge [MSFT] 2013-04-24 18:55:06 UTC
Can you try this to see if anything improves: https://bugzilla.xamarin.com/show_bug.cgi?id=11341#c3 ?

Note that this test will break debugging on device, you'll likely have to undo it for device debugging to work.
Comment 9 PJ 2013-11-19 17:04:46 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 10 PJ 2013-12-05 18:34:56 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.