【问题标题】:Xamarin Android (Visual Studio 2015) Could not connect to the debuggerXamarin Android (Visual Studio 2015) 无法连接到调试器
【发布时间】:2015-12-11 21:49:02
【问题描述】:

我在使用 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 ---

非常感谢任何帮助!

【问题讨论】:

    标签: android debugging xamarin android-emulator visual-studio-2015


    【解决方案1】:

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

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

    简而言之:

    • 在 Android 项目 -> 属性 -> Android 选项 -> 打包中禁用“使用快速部署(仅限调试模式)”

    • 在 Hyper-V 管理器中启用“迁移到具有不同处理器版本的物理计算机”,转到 VM -> 设置 -> 处理器 -> 兼容性

    【讨论】:

    • 只有第一个“使用快速部署(仅限调试模式”)对我有用!
    • 在使用 Visual Studio for Mac 的 Mac 上,我只需取消选中/禁用我的 Android 项目的“快速装配部署”(选项 -> Android 构建 -> 常规 -> 打包和部署)。谢谢!
    • 我只需要为我的虚拟机“迁移到具有不同处理器版本的物理计算机” - 非常好!
    • 这两种组合变化单独对我来说非常适合。谢谢你的回答。
    • 实际上打开快速部署为我解决了这个问题,哈哈
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

      接受 stdout 和 stderr 时出错 (127.0.0.1:8896) 地址已在使用中

      这已作为Bug 34476 报告给 Xamarin。

      【讨论】:

        【解决方案4】:

        虽然问题是针对 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

        【讨论】:

          【解决方案5】:

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

          为我解决的问题是删除我的模拟器并重新添加它。

          【讨论】:

            猜你喜欢
            • 2017-03-06
            • 1970-01-01
            • 2015-02-19
            • 2016-05-03
            • 1970-01-01
            • 2016-07-20
            • 2017-06-23
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多