c# - Xamarin.iOS 调试器不附加

标签 c# ios xamarin.ios xamarin

我们有一个特定的应用程序,调试器不会将其附加到 Xamarin Studio。我们尝试了最新的稳定版和测试版 channel ,但没有成功。它发生在模拟器或设备上。

当调试器分离时,我们可以在 XCode 的控制台中看到:

        Jun 18 15:41:51 Hitcents-iPad-2 kernel[0] <Debug>: lockbot[3258] Builtin profile: debugserver (sandbox)
        Jun 18 15:41:51 Hitcents-iPad-2 com.apple.debugserver-199[3270] <Warning>: Got a connection, waiting for debugger instructions.
        Jun 18 15:41:51 Hitcents-iPad-2 com.apple.debugserver-199[3270] <Warning>: 1 +0.000000 sec [0cc6/0303]: error: ::ptrace (request = PT_THUPDATE, pid = 0x0cc7, tid = 0x2503, signal = -1) err = Invalid argument (0x00000016)
        Jun 18 15:41:51 Hitcents-iPad-2 com.apple.debugserver-199[3270] <Warning>: 2 +0.004989 sec [0cc6/1303]: error: ::read ( 5, 0x2fe809fc, 18446744069414585344 ) => -1 err = Bad file descriptor (0x00000009)
        Jun 18 15:41:51 Hitcents-iPad-2 com.apple.debugserver-199[3267] <Warning>: 1 +0.000000 sec [0cc3/0303]: error: ::read ( 5, 0x2fd4bebc, 1024 ) => 0 err = Bad file descriptor (0x00000009)
        Jun 18 16:55:11 Hitcents-iPad-2 mobile_installation_proxy[3471] <Error>: main: Could not receive request from host.
        Jun 18 16:55:11 Hitcents-iPad-2 mobile_installation_proxy[3468] <Error>: main: Could not receive request from host.
        Jun 18 16:55:12 Hitcents-iPad-2 BattlePillars[3474] <Warning>: MonoTouch: Debugger not loaded (disabled).

有什么想法吗?除了这个应用程序之外的其他应用程序工作正常,我们看不到这个特定应用程序会导致它的任何差异。

我目前的版本是:

  • Xamarin Studio - 4.0.9
  • Xamarin.iOS - 6.3.6.77
  • XCode - 4.6.3
  • iOS - 可以是设备或模拟器,只试过 iOS 6.x
  • 此外,在每个开发人员的 Mac 上都会发生,因此似乎特定于项目/解决方案

这是我的项目文件的片段:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
    <ProductVersion>10.0.0</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{07958BCE-7F33-4F8F-9A86-5102FF4632FB}</ProjectGuid>
    <ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Exe</OutputType>
    <RootNamespace>MyAppName</RootNamespace>
    <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
    <AssemblyName>MyAppName</AssemblyName>
  </PropertyGroup>

<!--Further down-->

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
        <Optimize>False</Optimize>
        <OutputPath>bin\iPhone\Debug</OutputPath>
        <DefineConstants>DEBUG, IPHONE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
        <ConsolePause>False</ConsolePause>
        <MtouchDebug>True</MtouchDebug>
        <CodesignKey>iPhone Developer</CodesignKey>
        <CrashReportingApiKey />
        <MtouchI18n />
        <MtouchArch>ARMv7</MtouchArch>
        <IpaPackageName />
        <OptimizePNGs>false</OptimizePNGs>
        <MtouchLink>None</MtouchLink>
        <MtouchExtraArgs>-v -v -v</MtouchExtraArgs>
      </PropertyGroup>

解决方案:

有两个地方可以检查:

  • Project Options->iOS Build->Additional Options = 勾选
  • 项目选项->编译器->常规选项->调试信息=完整

此外,我们有一个 Objective-C 绑定(bind)使问题 (TestFlight) 复杂化,需要这个集合来修复调试构建:

#if !DEBUG
     TestFlight.TakeOff("key");
#endif

否则它会在 Debug 中崩溃。

最佳答案

是否有人不小心关闭了调试器? :) 检查项目选项 -> 构建 -> iOS 构建 -> 启用调试

关于c# - Xamarin.iOS 调试器不附加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17178613/

相关文章:

c# - 如何对 Visibility 属性进行简单的 XAML (WPF) 条件绑定(bind)

c# - .NET 中的 Erlang 风格的轻量级进程

c# - 当您在需要 Expression 的地方使用自定义方法时,如何创建 C# 编译错误?

iphone - 如何找到 UIViewController 是在事件还是非事件 iPhone 应用程序中?

c# - Xamarin.iOS NSUnknownKeyException 原因 : [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key staticDataSource

ios - 如果我无法从另一个线程调用 UIKit,如何在 Dispose 中进行清理?

c# - 验证应用程序是否正在运行,如果没有则启动它

ios - 在 swift 中在矩形上绘制渐变

ios - Obj-C block 作为参数

macos - 如何从命令行在 Visual Studio 中构建 Xamarin DLL?