0

We have a specific app that the debugger just won't attach with Xamarin Studio. We have tried the latest Stable and Beta channels with no luck. It happens in the simulator or on the device.

When the debugger detaches, we can see this in XCode's console:

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

Any ideas? Other apps besides this one work fine, and we can't see any difference in this specific app that would cause it.

My current verions are:

  • Xamarin Studio - 4.0.9
  • Xamarin.iOS - 6.3.6.77
  • XCode - 4.6.3
  • iOS - can be device or simulator, have only tried iOS 6.x
  • Also, happens on every developer's Mac, so seems specific to the project/solution

Here is the snippet of my project file:

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

SOLUTION:

There are two places to check for this:

  • Project Options->iOS Build->Additional Options = checked
  • Project Options->Compiler->General Options->Debug Information = Full

In addition, we had an Objective-C binding compounding the issue (TestFlight) that needs this set to fix debug builds:

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

It would crash in Debug otherwise.

Ja͢ck
  • 170,779
  • 38
  • 263
  • 309
jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182

2 Answers2

4

Did someone accidentally turn the debugger off? :) check project options -> build -> iOS build -> enable debugging

escrafford
  • 2,373
  • 16
  • 19
3

Add "-v -v -v" (without quotes) to the additional mtouch arguments in the project's iOS Build options, recompile, and see if anything is printed to the Application Output and (Device/System) Console.

Rolf Bjarne Kvinge
  • 19,253
  • 2
  • 42
  • 86
  • I don't see anything new, but I added a couple more lines that were in XCode's console. – jonathanpeppers Jun 18 '13 at 21:56
  • @jonathanpeppers: That's the only "MonoTouch: " line? If that's the only line then you must have somehow disabled debugging in the app's settings. – Rolf Bjarne Kvinge Jun 19 '13 at 07:19
  • See my project file above, `` is true. Do you see anything else that would turn it off? I also double-checked the configuration mapping in the solution, and those are fine too. – jonathanpeppers Jun 19 '13 at 12:46
  • @jonathanpeppers: sorry I wasn't clear, I meant the app settings as shown in the device's Settings (open Settings on the device, and at the bottom there will be a list of apps, one should be your app and you should have a "Debug Settings" section where "Enabled" is ON). – Rolf Bjarne Kvinge Jun 19 '13 at 13:39
  • Yeah, the settings group isn't present at all for this app. Tried deleting it from the device and re-deploying. What would remove it? I don't have a custom settings bundle or anything. – jonathanpeppers Jun 19 '13 at 13:44
  • Ok, there is no 'Settings.bundle' in the app bundle in the Debug build output... Any ideas? – jonathanpeppers Jun 19 '13 at 13:52
  • The Settings.bundle is not created for a release build (which is not your case)... what happens if you create an empty Settings.bundle in your project? In theory Xamarin Studio should inject the Debug Settings we need. – Rolf Bjarne Kvinge Jun 19 '13 at 14:51
  • Ok, that made the app show up in settings, but all the debugger settings are not there--there is basically an empty page. Should I open a bug and see about uploading this project for you guys to look at? – jonathanpeppers Jun 19 '13 at 14:56
  • Yes, I believe that would be the easiest by now. – Rolf Bjarne Kvinge Jun 19 '13 at 15:17