Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Android (Visual Studio 2015) Could not connect to the debugger

I have a problem with the android debugger (Visual Studio 2015) as it always stops immediately after starting debug (it works just fine without debugging), I had my machine reset and reinstalled Visual Studio 2015 but it does not help.

Here is the log from logcat: monodroid-debug Error accepting stdout and stderr (127.0.0.1:8896) Address already in use

Here is the log from Xamarin log:

Mono.Debugging.Soft.ConnectionException: Could not connect to the debugger. ---> Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.

Server stack trace: 
at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
at Mono.Debugger.Soft.Connection.VM_GetVersion()
at Mono.Debugger.Soft.Connection.Connect()
at Mono.Debugger.Soft.VirtualMachine.connect()
at Mono.Debugger.Soft.VirtualMachineManager.Connect(Connection transport, StreamReader standardOutput, StreamReader standardError)
at Mono.Debugger.Soft.VirtualMachineManager.ConnectInternal(Socket dbg_sock, Socket con_sock, IPEndPoint dbg_ep, IPEndPoint con_ep)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at Mono.Debugger.Soft.VirtualMachineManager.ConnectCallback.EndInvoke(IAsyncResult result)
at Mono.Debugger.Soft.VirtualMachineManager.EndConnect(IAsyncResult asyncResult)
at Mono.Debugging.Soft.SoftDebuggerSession.<>c__DisplayClass9.b__8(IAsyncResult ar)
--- End of inner exception stack trace ---

Any help is much appreciated!

like image 825
Khang Tran Avatar asked Sep 15 '15 15:09

Khang Tran


3 Answers

I had same issue and I was able to connect debugger by following this:

http://dotnetbyexample.blogspot.cz/2016/02/fix-for-could-not-connect-to-debugger.html

In short:

  • Disable "Use fast deployment (debug mode only)" in Android project -> Properties -> Android options -> Packaging

  • Enable "Migrate to a physical computer with a different processor version" in Hyper-V manager go to VM -> Settings -> Processor -> Compatibility

like image 101
akl22 Avatar answered Nov 13 '22 04:11

akl22


For me, this turns out to be an issue of DELL laptop running on Windows 10, after I rolled back to Windows 8.1, it works fine now

like image 1
Khang Tran Avatar answered Nov 13 '22 05:11

Khang Tran


Error accepting stdout and stderr (127.0.0.1:8896) Address already in use

This has been reported to Xamarin as Bug 34476.

like image 1
ta.speot.is Avatar answered Nov 13 '22 04:11

ta.speot.is