On Sat, Feb 13, 2010 at 1:17 AM, Joar Wingfors
<email@hidden> wrote:
On 12 feb 2010, at 20.00, John Engelhart wrote:
> One quirk that's recently appeared is that the build system won't "catch" that I've modified a file. It's usually when I do a trivial modification, like I'm trying to hunt down a bug, and I comment out a single line and rebuild / run. The build progress window pops up, and "stuff happens", but every once in awhile it doesn't actually get around to recompiling the changed file.
I'm pretty sure that I know what's causing this. When you invoke the Cmd+/ keyboard shortcut to comment out some code, the command isn't executed synchronously, and if you're quick enough, you can in certain cases have time to hit Cmd+S and / or Cmd+B before the change is applied to the source file. This would, obviously, lead to this file not being saved / or processed during a build. If this matches what you're seeing, I'd suggest that you file a bug report. Always file bug reports when you have concrete issues or suggestions. The best workaround for now would be to verify that your code actually was commented out, and that the file was actually saved, before invoking a build.
Well, that's a reasonable guess, but it's the cause of what I've seen / saw. In particular, I didn't even know that you could use Cmd+/ to comment something out- I've always used "//" (or whatever is appropriate). I know that in one case, it was a "#if 0" / "#if 1" block, where the 0 or 1 was changed to "comment out some code".
I have no idea how Xcode is implemented internally, but I gotta say, dispatching stuff like "Cmd+/" asynchronously seems... like an extremely poor design choice. I can't actually imagine how you'd pull off something like that and have it work consistently and correctly. There's a definite expectation from the user that "user input events" happen in a sequential order, at least for the vast majority of things... and having "Cmd+/" complete before "Cmd+S" / "Cmd+B" (assuming they were 'typed' in that order/sequence) is definitely one of them. I'd go so far as to say if you can actually get Xcode to do that, it's a bug in Xcode. I mean, when I type "abcdef", I expect "abcdef" to show up, not "debafc".
Regardless, one of the first times I noticed this, I spent about 10 minutes screwing around with it. I'd make a change. Save the file. Actually check the file in a Terminal.app window (the file was updated with the change). Then kick off a build with Cmd+B. The build would not detect the fact that the file was changed. I repeated this three or four times right in a row, and the build system simply wouldn't detect that the file had changed. I finally had to do a complete clean of the target and rebuild everything for the change to take. Now it's to the point where if I notice it, or have the slightest suspicion that the problem is happening, I clean the target, kill and restart Xcode, and rebuild.
It really sucks when you can't depend on your tools. And I can't reproduce it. Some times I can go a few days and it wont happen. Then it'll happen just once. You can't really file a bug on that: "Bug report: Xcode doesn't work." would probably be about as useful description of the problem. And I'm sorry to say this, but it's been my experience that it's pretty much a waste of time for me to file bug reports anyways with Apple. They just vanish, stay open for-ever, or you have to battle with some first level person who's job it is is to shield the levels above him. A long time ago I realized that it was a complete waste of my time to try to be a "good citizen" with bug reports to Apple- and a lot less frustrating to boot.