Xamarin Android (Visual Studio 2015) 无法连接到调试器

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

我的 android 调试器 (Visual Studio 2015) 有问题,因为它总是在开始调试后立即停止(无需调试也能正常工作),我重置并重新安装了我的机器 Visual Studio 2015 但它没有帮助。

这是来自logcat的日志:monodroid-debug Error accepting stdout and stderr (127.0.0.1:8896) Address already in use

这是来自 Xamarin 日志的日志

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 ---

非常感谢任何帮助!

对我来说,这是DELL笔记本电脑运行在Windows 10上的问题,我回滚到Windows 8.1后,现在可以正常使用了

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

已向 Xamarin 报告为 Bug 34476

我有同样的问题,我可以通过以下方式连接调试器:

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

简而言之:

  • 在 Android 项目中禁用 "Use fast deployment (debug mode only)" -> 属性 -> Android 选项 -> 打包

  • 在 Hyper-V 管理器中启用 "Migrate to a physical computer with a different processor version" 转到虚拟机 -> 设置 -> 处理器 -> 兼容性

虽然问题是针对 VS 2015 的。最近 visual studio 2017 版本 15.2 有这个问题。 卸载 visual studio 并降级到以前的工作 VS 对我的情况有所帮助。希望他们能尽快修复该错误。 https://forums.xamarin.com/discussion/95555/how-to-downgrade-visual-studio-2017-version-15-2-to-15-0

我在 VS 2019 上遇到了同样的问题。

为我修复的是删除我的模拟器并重新添加它。