I recently removed some old test classes from my project and deleted the files. As expected, the files were moved to the trash and showed up as removed in git.
Unfortunately, the test classes and the test cases they define continue to appear in the test navigator. I've tried the usual suspects like cleaning & rebuilding, and quitting & reopening Xcode.
The remaining tests run just fine; at the end of an all-tests run, the navigator shows the phantom tests with no indicated status.
I've begun to think that there is some erroneous state in the project file that's keeping these phantom test cases around, but I don't know enough about the internals to debug further.
My problem is distinct from the scenario described here because all of my test cases stick around in test navigator, rather than all disappearing.
Delete the DerivedData directory. Apparently Xcode parses the test classes and writes test definition files of some sort to DerivedData. It then uses those definition files to populate the test navigator.
Unfortunately, deleting a test class from within Xcode does not cause that cache to be invalidated and rebuilt. Instead, one must clear the cache manually.
I had incorrectly assumed that the test definitions are stored in memory, which is why I expected quitting Xcode would solve the problem.
I found I had to do the following steps in order, otherwise the deleted tests reappear:
Close the project (but don't quit Xcode).
Window > Projects > select the project.
Click the "Delete" button next to "Derived Data".
Quit Xcode and restart.
Wait for Xcode to finish indexing.
Run the tests.
Related
So, new to .NET Core and going slow. Followed a standard tutorial for ASP.NET Core MVC app using Entity Framework to connect to MSSQLLocalDB - this went well.
Converted the application to connect to MySql, and went equally well,
Changed the name of a table on MySql to Interests from Interest, and after a bit of fiddling around this to was put to bed, that is it was working as expected.
Went to run the application today and I get:
There were Build Errors Would you like to continue and run the last successfull build.
Code has reverted to Interest, from Interests in several places in Obj files,
for instance "Create.cshtml.g.cs"
Corrected the code and went to run, the same build error pops up, and all corrections are undone.
I make the changes again, save the files, exit VS, reload, the changes are as they should be, run and it reverts all changes, failing again.
I thought this might be some sort of cache issue so deleted the obj folder, again corrected the entries, but again run the build and the corrections reverted!
I solved this issue on my machine by changing the cshtml file properties. Right click the chstml file in the Solution Explorer window, click on Properties in the context menu.Then in the Properties window, change the "Copy to Output Directory" to "Copy if newer". Then make sure "Build Action" is set to "Content".
I had a Windows Forms application that needed some UI and code changes changes made to it. I made the proper changes (mainly deleting a few controls and moving some code). Oddly after the changes were made, I would rebuild run, and despite the changes, the changes being saved, and builds being made multiple times,the application would always run as if the changes were never made.
I tried to Build -> Clean Solution a few times, with no avail. I decided to try manually deleting the bin and obj folders and rebuild. However, after closing the solution, deleting those folders, I tried to build again and get the following error:
OutputPath and AssemblyName are set correctly as far as I'm aware. This only affects Debug, Release runs fine (sort of) and even in debug XML and *.vshost files are created, but not the executable. I've tried restarting VS a few times to no avail. What in the world did I do and how do I fix it?
EDIT After right clicking on the solution and doing a batch-build on all projects in the solution, things started working. I still have no idea what happened, so if anyone has any theories feel free to comment.
Does the Output window provide any details about where the .exe was created?
You may need to increase the verbosity of the logging. To do so, go to the Options dialog (Tools > Options) and open "Projects and Solutions" > "Build and Run." Change the "MSBuild project build output verbosity" and recompile.
I have an Xcode 4 workspace with several projects. Everything builds perfectly and works as expected, only Xcode recompiles files too often. If I hit the Build button, wait for the compilation to succeed and then hit the button again, shouldn’t that be essentialy a no-op, since no files have changed? Because my Xcode recompiles a big part of the project again. Even when I build and then immediately hit the Play button, I have to stare at the building process again. Is that neccessary, is it expected behaviour?
Shot in the dark, but do you have external xcode projects linked? XCode may be recompiling because it doesn't know the state of those projects.
Either way, you can always Run Without Building ^⌘R (control + command + r)
Are you executing custom scripts that change files before compilation? This will result that xcode will recompile all touched files even though maybe nothing changed.
You can turn this off by enabling a checkmark in the run script build phase. This will execute the script only on installation of the app.
The image below shows the actual checkmark.
I am running a "old" Xcode 3 project in Xcode 4 and code sense is not working for my own classes. I have tried following:
Clean/rebuild
Remove Derived Data
Installing 4.3 documentation
Restart
Without any luck.
Sometimes the code sense works but mostly I just get "No Completions".
Try this:
Open Organizer then Project Tab.
Clear the "Derived Data". Xcode should re-index your project then and code sense should work. At least worked for me.
I know this is late, but for reference: http://sealedabstract.com/code/when-xcode-4s-code-completion-autocomplete-breaks/
Close the project, leaving XCode still running.
Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.
Quit XCode.
Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”
Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.
Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”
When your CPU spike returns to earth, code completion will be working again.
There's a lot of deleting going on there so please be careful, but this definitely worked for me.
I've been doing this, and it's worked multiple times for me (after trying all of the above previously).
Edit: Now I just hit space, backspace (the mac version) and rebuild... works nice. Then, remember to scroll (sometimes the colors don't show up until you scroll somewhere)
Find your prefix file: "ProjectName_prefix.pch".
Comment out some line. (basically change it)
Build your project, doesn't matter if it fails or not.
Uncomment it.
Build again.
I'm betting only step 2 (modify the prefix) is what does it, but these essentially get you back to running. Suddenly everything magically recolors itself and completes functions.
Good luck if that doesn't fix it, perhaps try doing this to your dependency pch files (three20 or FB api's)
Clearing the "Derived Data" only works temporarily for me. I have to do it and then restart Xcode like 3-4 times each day to get code sense working again.
I found out the real cause is in the Target's Build Settings. I moved everything from Header Search Paths to User Header Search Paths and it is fixed. In my case, the framework I'm working with is RestKit.
BTW, I came up with this because I was adding another project (QuickDialog) into my project and I was curious that it is using User Header Search Paths, but not Header Search Paths. Here is the difference between them.
You can able to fix that issue by change build settings like this, PreCompile Prefix Headers :NO
FYI, if one file doesn't have code sense but the rest of your project does, check that its added to a target. Once I did that I got code sense back in that file.
It's been ages but the answer is just to move the code into a new folder and the code sense should be working now.
This happened when I added a new Objective-C Class and the code sense doesn't work only on the newly added .m and .h files (on XCode 4 latest update during this post).
Close all xcode windows
Delete all your projects from xcode>window>organizer and restart your project. It will now sense and index your project properly.
I wrote about it in detail here.
Basically my fix was that with localization. I upgraded from xcode 3.2.5 to xcode 4 and then screwed around with built in interface builder and turned on localization for a XIB file accidently which placed my source files in en.lproj directory. After moving them back to Classes folder it worked perfectly.
Again, for the sake of helping others with this issue which, in my case, happened upon upgrading to Xcode 4.3.
Of course I tried the solutions offered in this post, and none of them worked. But the suggestion to move the location of the project in Finder brought back some Code Sense, but the suggestions didn't make any sense.
I ended up deleting my project and re-cloned it from the git repository.That brougt back Code Sense for me...
I open a second project in the background whenever my Xcode's code sensing stops working (it usually works the first time i open the project but after a while code sense no longer works). So what i do is to open a second project in Xcode. Xcode will start indexing the second project and magically the code sense for my main project is back.
Running Xcode 4.3.1 on Lion
Hope this helps someone.
From this comment here I was able to debug the problem on my end, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
in Terminal increases the verbosity of the indexer, and should help you track down issues. Open Console.app and look for messages from Xcode, the search string IDEIndexingClangInvocation helped me find them.
For me it happened simply because the file had no target membership. If the first few answers did not work for you, go to your .m file (presumably it's this file that you're having trouble with), open the Utilities view (Edit -> Utilities -> Show File Inspector) and under "Target Membership" check the target to which you want this file to belong.
Over time there are many past log entries (for either build or debug sessions) accumulated in the Log Navigator. How can I remove these entries?
Turns out this is what you have to do:
Go to Organiser
Go to Project tab
Select your project
Select the Delete button on the right hand side where it says "Derived Data includes Index, build output and logs"
Close the project or workspace.
Re-open the project or workspace.
Note that the comments are correct. This approach does delete the index, and build output in addition to the logs. It does warn that "The first indexing and rebuild of a project after that may be slower".
I know this is a bit old, but I think the accepted answer is an awkward way to do it (though it will certainly work!). It's easier to do this in Finder.
By default, Xcode stores its data inside its DerivedData folder.
Quit Xcode.
In the Finder choose Go -> Go to Folder…. Paste ~/Library/Developer/Xcode/ into that. (Or otherwise navigate there.)
Every Xcode build artifact (including logs, compiler object files and finished/linked executables) that hasn't been archived is inside DerivedData. So go ahead and drag DerivedData into the Trash.
You can, of course, delete individual folders instead. But since these folders rebuild are derived data and will be rebuilt completely when you rebuild your projects, there's very little reason not to delete all of DerivedData.
If you do a lot of work in the command line, you can do this there, too:
$ rm -fR ~/Library/Developer/Xcode/DerivedData
I do this several times per day sometimes, if I'm switching rapidly between branches and worried Xcode could get confused. And doing it after an Xcode update saves you from any worry that Xcode might not rebuild everything, requiring you to clean projects.
I should note that this only applies to DerivedData. Some of the other folders in ~/Library/Developer/Xcode are quite important:
Archives stores the result of every Product->Archive you've done. While you might want to delete some of these, you're rarely going to want to delete them all.
UserData stores your code snippets, fonts and colors, keybindings, and source control author names.
If you want to know what the rest are, have a look through them. But don't delete them blindly, like you can with DerivedData. :)
This works in Xcode 5 and may work in Xcode 4:
If you just want to clear the million entries in the Log Navigator, try closing the project/workspace and reopening it. (Close, Open Recent)
This cleared the Log Navigator for me, was less effort than doing anything in the Organizer window, and did not delete the index or build output.