After updating some NuGet packages, it turned out that some things in my website got broken by new code. I updated to the new Unity inversion control 5.0.0, etc. So after a while of hunting around and trying to fix it, I was able to get it to finally build and launch the site. However, the Unity IOC was broken because I kepts getting the "Error in Application '~/', controller must have a parameterless constructor". I saw that my couple of Unity files (UnityConfig.cs and UnityMvcActivator.cs) were gone, so I replaced them with ones I had in the backup folder.
Well, now it launches a loading site, but in VS it now says "UnityContainerExtensions.cs not found". I see that it looks all over for this file, around 'C:\ Program Files (x86)\Microsoft Visual Studio 14.0\VC...' and then it goes looking through 'c:\projects\unity]Abstractions\src\Utility...' - a folder that I can't even see.
This is in VS2015, doing a web application with Framework 4.6.
What can I do to just make it work again, as when I first had it so many months ago?
Alright, I was able to fix my Unity problem by rolling back on some of the packages. I'm the kind of person who likes to have no notifications, so I clicked Update All, and apparently the updates weren't necessarily compatible with my project here. To get it working again I has to bring back:
Unity.Abstractions = 2.0.0
Unity = 4.0.1
Unity.AspNet.WebApi = 4.0.1
Unity.Mvc = 4.0.1
Now to great relief, all works just as it did before!
However, I do wish I knew why the breakages happen and also why these packages are listed as updates when they are not going to work with my project.
Till the future, my system is going to have to consist of a Post-It "Do not update these xxxx packages, they will break stuff". And I wish to gain an understanding of what is the reason behind such Unity mess.
I've spent the past few months converting a project of mine with about 1500 source code files into Swift. It was incredibly tedious, but I finally did it. It runs well, builds well, but:
When I attempt to archive the project, Xcode fails with the following error:
ditto: can't get real path for source '/Users/USER/Library/Developer/Xcode/DerivedData/
APP-dtsbrzschafjiubelceuxtfwstqf/Build/Intermediates/ArchiveIntermediates/APPCore/
IntermediateBuildFilesPath/APPCore.build/Release/APPCore.build/Objects-normal/
x86_64/APPCore.swiftmodule''
Command /usr/bin/ditto failed with exit code 1
APP being the app and APPCore being the embedded framework.
What I've tried:
cleaning the project (which really has no effect when archiving, since archive always compiles from scratch)
using Xcode 7.2 beta (released a few days ago)
making as many declarations as possible non-public
disabling any Swift optimizations for the release build configuration
building the APPCore framework as release - which actually works (!) - and does (!) create the .swiftmodule file
The last part being the strangest here. This evidently points to the archive doing something slightly different, but I have no idea what.
My question is if anyone has any idea why is this happening and how to debug this. I've spent the last two days trying to figure this out, but no results...
I've googled this error as well, but unfortunately, the answers were fairly limited and suggesting to comment all lines of code and then start slowly uncommenting them until the project builds. Which is OK for a smaller project, but not for a 25KLOC project, mainly when you have absolutely no idea where to start...
I had the same issue and your question actually helped me to solve it (Xcode 8).
In debug mode just got the "ditto: can't get real path for source" without any further information. Switching to release mode showed me that the problem was that the framework wasn't allowed to have a bridging header file. I went to the build settings and removed the bridging header file (don't know why there was one) and it now compiles both in release and debug mode.
Just upgraded to Visual Studio 2015 and the Code Definition Window is not working.It just says "No definition selected" no matter what I select. Project is Windows Forms written in C#.
Go to Definition and Peek Definition are working fine
Went back to VS2013 to try it out and it's still working there
Tried to make a brand new project in VS2015 to see if it was project related, but it was not
Checked with a couple of colleagues and it wasn't working for them either
I have a feeling this is either a bug in VS2015 or some sort of configuration change.
Anyone found a way to configure it, or any sort of work around to get it up and running again?
I got a reply from Microsoft on my Bug report. Turns out it's not implemented and possibly never will be:
Hi,
Based on the fact that Peek Definition was introduced in VS2013,
combined with telemetry data that shows that only a tiny percentage of
users ever display the Code Definition Window, we decided not to
implement support for it as part of Roslyn. I've filed an issue on our
GitHub project to consider resurrecting it.
Thanks for the report!
-- Kevin Pilch-Bisson Visual Studio Managed Languages
Here´s the github issue Kevin created in response to my bug report in July: https://github.com/dotnet/roslyn/issues/4224
Looks like they just merged a fix for this into Roslyn:
https://github.com/dotnet/roslyn/pull/56102
I'm currently developing an iOS app using swift and Xcode 6 (Beta 3).
Everything went fine so far but now as my project grows, Xcode suddenly began indexing and it does that again and again, making Xcode nearly unusable.
I have searched the web for similar problems and tried the solutions but none of them did help.
Even disabling the indexing process (defaults write com.apple.dt.Xcode IDEIndexDisable 1) does not stop Xcode to do that.
While indexing, my CPU usage goes up to 300%+, causing the fans to run at highest speed.
In Activity Monitor there are several tasks named "swift" taking up about 1GB memory each.
Killing the processes named 'swift' and then checking the error in xcode will give you the part of the code giving you trouble. There are some bugs in swift that needs to be circumvented.
To kill the process: Applications > Utilities > Activity Monitor. Then find the "swift" process, double click and choose Quit or Force Quit.
Happened to me with Xcode 7.3
Had to clean everything Xcode had cached to solve it.
Solution:
rm -frd ~/Library/Developer/Xcode/DerivedData/*
rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
I had this same issue and it took me FOREVER to solve it. I'm pretty sure I've seen every question on the internet about this issue and I tried all of the solutions. Turns out all I had to do was....
Restart my computer
Solved it: I deleted the most recently added files from the project and the problem disappeared. Then I started to add back the files, one by one until the problem reappeared. So I found the file causing the problem. Then I deleted the most recently added code from that file and again, the problem disappeared.
That way, I found a piece of code which was responsible for that behavior.
I had the same issue in my code. The solution for me was delete all spaces in the array in my code.
Ex.
struct Objects {
let objectA = ["text1",
"text2",
"text3",
"text4"] }
// Noise, CPU 100% and Index forever. The solution is...
struct Objects {
let objectA = ["text1","text2","text3","text4"]}
// Solved making the Array or String with no space.
I had that problem when I was at the swift crunch in krakow a couple weeks ago. We had the code on github, experienced that indexing problem on a macbook, we tried pulling the repo on 2 other macbooks, same result.
It's clearly a bug, I don't know what is causing it, we tried whatever we could think of (clean, clean build folder, manually removing files not in the repo, rebooting, killing processes, etc.), and after a couple hours the only thing left to do was creating a new xcode project from scratch and manually importing the files from the other project.
Never happened again since then, neither on that nor on other projects.
For me, I made a stupid mistake. I write a Class like this:
class A: A {
.......
}
A class inherit itself that causes the freezing. There is no message hint from Xcode. You can just take this as possible reason ~ .
It's Xcode bug. Problem caused with concatenation in one line:
var value = "some text" // it can be String or Array
value = value + value1 + value2 + value3 + value4 + value5 + value6 // etc
This correction fixes this bug:
var value = "some text"
value += value1
value += value2
value += value3
value += value4
value += value5
value += value6
I was creating a dictionary like this
var dic1 = [
"isDestination" : self.isDestination ?? false,
"price" : self.price ?? ""
]
and self.price is of type Int and I was giving its fallback value as an empty string which screwed up the Xcode compilation.
I got this issue and 6 hours later (after trying everithing and build new project again step by step copying resources) I FOUND MY PROBLEM:
class A : A {
...
}
By the fact of copy/paste I had a class that extends itself, and this makes indexing crazy.
It's definitely a Xcode bug and I reported that to Apple. When you have a large dictionary literal or a nested dictionary literal. You have to break your dictionary to smaller parts and add them with append method until they fix the bug.
Xcode 8.2.1 (8C1002)
I had the same problem with one call adding 11 NSLayoutConstraint objects to an array.
The solution was to divide the code into several calls, each adding only 3 objects to the array. Weird.
That was in Xcode 6.4
Too many string concatenations in one line cause troubles. Helped me too.
Originally was pointed by Zhenshan Yu there: Xcode 6 Beta not compiling
I had this issue with XCode 6.3 when creating a C++ project. Before switching over to developing in SubLime, my last ditch effort was to delete the XCode app and reinstall. It was a long process, but my version of XCode is now updated to 7.3 and everything is working as it should.
So if nothing else seems to be working, you could try deleting XCode from your applications folder and then reinstalling. Just be sure you aren't deleting any project files you want to keep.
Mine was about dragging a new file with String extension to the project and not adding it to all required targets.
Hope that helps someone.
Backup your project delete the lastone and restart the xcode simple :-)
I too faced the same issue for Xcode 9.1.
So i looked into Activity Monitor. There was swift process which was above 100%. Double Clicked it and Quit.
Done. Now its working fine.
I went to tools->task and contexts->clear contexts and that seemed to give the computer rest finally!
enter image description here
I got this issue when my Xcode was 9.2 . First I deleted xcworkspace file ,cleaned and built according to the others' answer.But it did not work.
Then I updated Xcode to 9.3 It also did not work. I checked my code and found that the recently written code made Xcode Indexing forever:
TimeInterval(3600*24*(-randomDay))
Then I amended it:
TimeInterval(-3600*24*randomDay)
It worked.
I find that many situations can cause Xcode to work abnormally.So I think the correct solution is that think about what you've done for your project recently
In my case the issue was caused by some aritmetic sums.
I was creating a collectionView with all the different frames programmatically doing it like this:
cell.textView.frame = CGRectMake(8 + 10 + 12, 0, 150 + 6 + 6 + 4, 50)
I just changed it to:
cell.textView.frame = CGRectMake(30, 0, 166, 50)
It helps me figure out the margins and paddings more easily, but just puting the result of the sum changed the build speed from 5 - 7 minutes to 20 seconds or so.
Yet one possible thing, that may cause such behavior:
For debugging purpose I changed system time, set up in one week ago - and I've got infinite indexing. As soon, as I set time back - indexing has stopped.
in my case i had the emulator open with an app builded with previous files. Just close de emulator
I've tried all the things listed, indexing is keep freezing.
This helped me:
If your indexing is freeze, and you have one or more swift process eating 99% of your cpu - just kill this swift task(s), wait a bit, and progress should move.
It can repeats, until it reaches finish, in my case I killed the process 7 times, but at the end, indexing was completed!
For me it was circular inheritance causing the issue:
class CustomButton: CustomButton {
...
}
And various other recent find/replace errors in the code. Xcode wasn't highlighting them as errors and just kept indexing.
I recognized today, that running Apples Playgrounds application alongside Xcode I have that very same symptoms. and maybe that was the root cause in earlier situations. So in my case, closing Playgrounds did the trick.
My particular problem was a fairly long literal dictionary containing much data.
My solution was to understand that Xcode indexing wasn't "stuck", but just taking a long time.
So I only had to wait more time than I expected.
Non of the answers helped in my case. I tried multiple things like:
Device and Simulators - Wifi connected device
Disconnect all devices which can be connected with wirelessly.
Removing Xcode's cache, derived data:
rm -frd ~/Library/Developer/Xcode/DerivedData/*
rm -frd ~/Library/Caches/com.apple.dt.Xcode/*
Deleting defaults for Xcode
defaults delete com.apple.dt.Xcode
Solution
What helped in my case was to rename project folder. Once I did that everything started working again.
In my case, I tried all the suggestions I found on the internet but nothing worked.
The solution that worked for me was to run another project on xcode that could be indexed, and once indexing was done I closed xcode and opened it on the first project that had indexing issues, and it works.
No idea why, but it works :)
This is a workaround I posted on another stackoverflow thread related to Xcode indexing problem. This question looks to be more swift related but my workaround can probably be useful here too. So here it is. My project is very big (merging objective c, c++, swift, and java files with j2obj) and none of the answers here solved the indexing problem. The idea is to limit the CPU usage of the Xcode indexing process with an external tool like cputhrottle.
So first you need to install cputhrottle in terminal
brew install cputhrottle
Then limit the Xcode indexing process like this (20 = 20%)
sudo cputhrottle $(pgrep -f com.apple.dt.SKAgent) 20
I've exposed my "solution" here with more details : How to prevent Xcode using 100% of CPU when indexing big projects