我们有一个调试器不会附加到 Xamarin Studio 的特定应用程序。我们尝试了最新的稳定版和 Beta 版渠道,但没有成功。它发生在模拟器或设备上。
当调试器分离时,我们可以在 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 工作室 - 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>
解决方案:
有两个地方可以检查:
- 项目选项-> iOS 构建-> 附加选项 = 选中
- Project Options->Compiler->General Options->Debug Information = Full
此外,我们有一个 Objective-C 绑定复合了需要这个集合来修复调试版本的问题(TestFlight):
#if !DEBUG
TestFlight.TakeOff("key");
#endif
否则它会在调试中崩溃。