Bug 3891 - Custom Settings.bundle makes debugger stop connecting
Summary: Custom Settings.bundle makes debugger stop connecting
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: 2.8.6
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2012-03-13 18:22 UTC by Adam Kemp
Modified: 2013-10-24 09:30 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Root.plist for our settings bundle (535 bytes, application/xml)
2012-03-14 11:08 UTC, Adam Kemp
Test project (11.58 KB, application/octet-stream)
2012-03-15 22:29 UTC, Adam Kemp

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Adam Kemp 2012-03-13 18:22:29 UTC
When we started included a custom Settings.bundle for our MonoTouch application we could no longer debug (it just keeps waiting for the app to connect to the debugger). It worked at first, and it appears that MonoTouch tries to merge our settings with the debug settings. However, after a clean build the merge did not take place. The debug settings were then missing from the settings bundle, and thus the app never tried to connect to the debugger. If I remove the custom settings bundle from my build and then do a clean build again then debugging starts to work again. Then I can reenable my custom settings. However, next time I do a clean build the debugger stops working yet again.

Since I think this is a built-time issue (not a debugger issue per se) I'm filing this under Tools.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-03-14 10:55:23 UTC
I tried this, and I couldn't reproduce it with a simple Settings.bundle/Root.plist. Can you attach your Settings.bundle directory to the bug so I can try it out?
Comment 2 Adam Kemp 2012-03-14 11:08:15 UTC
Created attachment 1516 [details]
Root.plist for our settings bundle

This is the Root.plist for our settings bundle. I did not include the Settings.bundle directory itself because it's just a folder, and this is the only file in it.
Comment 3 Adam Kemp 2012-03-14 11:09:40 UTC
Note that in order to reproduce this you have to have a custom settings bundle and then do a CLEAN build. If you build, then add a settings bundle, then build again it will work. However, if you then clean and rebuild it fails. Our group didn't notice it at first either for that reason, but as soon as I did a clean build I could no longer debug. We have reproduced this with multiple machines, so it's not just me.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2012-03-15 09:26:06 UTC
What's the build action of your Root.plist? It should be "Content", otherwise it won't be merged in.
Comment 5 Adam Kemp 2012-03-15 11:12:41 UTC
It is "Content". This is what the project file contains:

<Content Include="Settings.bundle\Root.plist">
Comment 6 Rolf Bjarne Kvinge [MSFT] 2012-03-15 18:17:17 UTC
I can't reproduce the behavior you see no matter what I do.

Can you try putting your Root.plist in a new project to see if it happens there too? And if so, can you then attach the entire project here?
Comment 7 Adam Kemp 2012-03-15 22:29:58 UTC
Created attachment 1526 [details]
Test project

Attached a test project. Just open and debug. The debugger fails to attach.

It looks like the difference is that the Root.plist is read-only. If I make it writable then it works. If I do a clean build while it's read-only then it fails.

Like the rest of our application, our Root.plist is in source control. The source is therefore read-only by default. It looks like something makes it writable in the root directory of the build output (i.e., bin/), but if you look at the version in the .app bundle it is read-only. Something is failing to change the permissions during the build.
Comment 8 Rolf Bjarne Kvinge [MSFT] 2012-03-16 20:52:58 UTC
Perfect, I can reproduce now => MonoDevelop
Comment 9 Jeffrey Stedfast 2012-04-24 14:11:39 UTC
it seems like a bad idea to just start overriding the file system permissions of all Content files, forcing them to be read-write when they are read-only in the project.
Comment 10 Miguel de Icaza [MSFT] 2012-04-24 14:25:25 UTC
Since this is a change that we need to make to merge the data, we should change the permissions.

Part of the design
Comment 11 Jeffrey Stedfast 2012-04-24 14:45:56 UTC
Looks like Alan already modified the build to forcibly add write-access to the entire output directory in the iPhone Build Extension code.
Comment 12 Jeffrey Stedfast 2012-04-24 14:50:28 UTC
I should mention that Alan's commit was made on 3/13/2012, looks like the fix just missed the release.
Comment 13 Dirk Eismann 2013-10-24 09:30:09 UTC
is this really fixed? 

I can still reproduce this issue in Xamarin Studio 4.0.12 b3 and Xamarin.iOS

As soon as I add a custom Settings.Bundle to my project debugging on the device stops working.