Need to always reload project in Xcode for it to function - xcode

I've built a couple dozen projects in Xcode and only one of them experiences this strange issue.
Every time I load Xcode to resume work on the project, Xcode auto-loads the project (good) but in an unusable state (bad). It appears this way:
The project name is grayed out, with no disclosure triangle. I cannot access any of its contents, and trying to build it fails immediately with no error message other than "Build Word Practice: Failed" as you see in the screenshot.
But if I close the project and reload it, it functions fine. The only oddity about when it loads this way is that it appears with all its disclosure triangles closed, and I have to manually "disclose" the contents of all the folders in the list each time:
I have had this issue with all recent versions of Xcode, up to and including the current version, 11.5.
The project does not use any features that are not present in other similar projects I've written that behave fine. So it would seem to be a matter of corruption… but besides deleting derived data and doing a clean build (which I've done), I can't think of any other steps to take.
I would include code here, but short of including the whole project (and I doubt that would help), I wouldn't know what to include.
Any ideas?

Related

How do you reset or reimport, plugins, in Unity / Mac?

Get a Unity project with a native low-level plugin .. Mac version.
Make a small change in the Xcode plugin project, and build.
You now have the new plugin library in the Unity project.
If you "Build" again, the final Mac app of course now contains the new library - no problem.
However .....
if you hit Play in the Editor,
it does not pick up the change in the library.
In fact it seems:
Every time you change a library in Unity, you must restart Unity!
Everything has been tried, "Reimport all assets", AssetDatabase.Refresh, renaming, etc etc. It seems you literally must restart Unity.
What's the deal on this?
More information on this:
It would seem that mac shared libraries/bundles cannot be unloaded. Article:
https://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm
Apparently this was fixed in 10.5:
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlclose.3.html
Maybe Unity could solve this now. At their usual pace it should happen anytime around 2035.
Sadly it comes down to you can't do anything about it.
As per .net's DLL handling DLL's cannot be unloaded individually without closing the application domain. And while Unity picks up the changes done to the DLL the old version is kept in memory and used at runtime in the editor. A "funny" thing you can do to see this in action is by deleting the native plugin from within the editor. Confirm that you want to delete the file. The file will dissapear from the inspector. However if you right click the folder and refresh (ctrl+r) you will see that the file gets reconstructed (this also happens when hitting "re-import all", as the application domain isn't closed, despite unity restarting).
When building the application it will however use the locally stored file, and not the memory stored file. Hence the plugin being updated on the build.
There is no way to unload an individual assembly without unloading all of the application domains that contain it. Even if the assembly goes out of scope, the actual assembly file will remain loaded until all application domains that contain it are unloaded.
source
This has been a problem for some time now, and people have made attempts for work arounds and/or fixes, but as far as I am aware the "work arounds" that exist now are for windows only. here are some links to discussions about it.
"Unload a plugin"
"Reloading native plugins"
I suppose something that could be done is writing a wrapper that automatically restarts Unity when the dll has been edited... Although this won't solve the issue it'll atleast make it somewhat less of a hassle.

Broken references in solution

I have a large solution with many project. We have about six developers working on this solution using VS2013 and it is source controlled by TFS 2013.
Periodically project references and file references to DLLs are broken. The little yellow sign with the black exclamation point shows next to the reference in the project references and when I look at the properties of the broken references, I noticed that the path was empty for the elements that are broken.
I could remove and re-add the references, but I have done this a few times before and it keeps breaking again.
I Googled around and found several people talking about similar issues, but in most cases I see, after removing and adding the references, everything is ok.
I my case, this keeps happening over and over.
Is there a known cause for this? I can keep re-fixing this, but it's just a workaround and not a solution.
Assuming ProjectFirst generates the DLLs for ProjectSecond, to narrow down the issue, you can first build the ProjectFirst and then build the ProjectSecond to see whether the behavior correct. If that works, you probably need to check your build order.
In Solution Explorer, select a project or select the solution. On the Project menu, choose Project Build Order to check the build order.
On the Dependencies tab, select ProjectSecond from the Project drop-down menu. In the Depends on field, select the check box of ProjectFirst that must build before this project does.
Additionally, check ProjectSecond to see whether it by default to targeting .NET Client Profile. If it is, change it to regular .NET.
We have a solution with hundreds of projects (> 400) and tens of thousands of source files and for some unknown reason a set of updates got applied to the machine right in the middle of a build, killing the build and closing Visual Studio. When VS was reopened some projects did not load (even after close and re-open) so had to sort through > 400 projects and find those that did not load and manually tell VS to reload the missing/not loaded projects. After that things seem back to normal.

All project references have yellow triangles every time solution is loaded

All my project (from the same solution) references are marked with a yellow triangle. The projects are all set to the same .NET version (4.5.1). The error log says:
The project 'CommonLibrary' cannot be referenced.
A way to temporarily fix the issue is to either:
Remove and re-add the references
Right click and choose Add Service Reference and immediatelly cancel.
However, the triangles come back every time I start the solution.
The solution is build successfully regardless or the issue. The real issue is that Resharper acts like the references don't exist.
Another thing that might be relevant is that I have 2 projects that are supposed to be unloaded but they become active every time I load the solution.
Any idea what to do with the issue?
I had similar issues and it usually comes down to the Target Framework (Project>Properties>Application). I was working on a solution using .NET 4.6 and for some reason the default framework for new projects have a different target (in my case it was 4.5.2). So make sure you check all your project at the very least have the same target framework.
Do the following:
In vs choose: tools->options->resharper->options-> general-> click the clear caches button.
then close all your opened tabs and shut down vs2013.
finally, start vs2013 again.
Let me know if that worked for you.
Try switching to managed compatibility mode in VS2013
you can do that by going to tools->options..->General tab and check the Use managed compatibility mode
I had the same thing happen but didn't suspect the 24 warnings I was getting was related to this error: Error 1 Unable to locate the .Net framework aspnet_merge.exe tool on path '~\Photo Archive\Main\etc\tools'. You need to set the msbuild property 'AspnetMergeToolPath' to the folder containing this tool. ODOT.PhotoArchive.Web
Trying to set the MS build property led to a lot of research just to find out WHICH property to set. So, Agent Ransack to the rescue -- searched my drive for the most recent version of the tool and copied it to the directory Visual Studio was complaining about.
Rebuilt the project with the idea of clearing the error but then the 24 warnings also disappeared.
FYI -- this is an MVC project which will replace a classic asp project. This might be peculiar to MVC projects.
At any rate, there was a lot of chasing snipes before this was finally tried. So, where this is happening, try handling any errors no matter how remote the possibility is they're related to the issue.
I had the same problem as you can see in this picture.
Its reason was the hidden folder. I had hidden the folder containing the project files. I got rid of this problem by unchecking the hidden attribute of the root folder containing the project files and restarting the visual studio.
Check it once, you might have checked the folder to be hidden.

XCode won't shake off residual memory of a renamed static library

I have a workspace that contains a project and a static library.
The library was called A originally and then I renamed it to B. However I changed my mind a little later and renamed it back to A.
The trouble is now that Xcode only lists liblB.a in Link Binary With Libraries and I simply cannot get this to go away and for liblA.a to reappear, even though I have renamed it back to A.
Within XCode the name of the target is A, also the name of the Product Name in the Build Settings is A. I don't have any references to anything named B anywhere anymore AFAIK or that I can find.
I've cleaned everything and cleaned again, deleted Derived Data in Organizer, closed and restarted XCode (which is an amazingly effective way to usually solve issues like this).
When I build the library it builds sucessfully and XCode say "Build A: Succeeded", it doesn't say "Build B: Succeeded".
I've seen this sort of problem before where XCode has problems shaking off references to things that no longer exist, and the usual solution is just to do a clean and a close of XCode. But that's not working this time. Any other suggestions on how to get XCode to forget about the name B and stack picking up A?
Thanks
Commit your code
Close Xcode
Open the xcodeproj file with your favorite text editor
Find all references to the undesired name and delete them or change them to the desired name
Open Xcode and test
If everything works, commit your code. Otherwise, revert and try again a little more carefully.
Generally, simple hand-editing the xcodeproj works fine, particularly to just rename or remove things. It's harder to add new stuff.

Xcode4 breakpoints adapt to code changes?

I have a series of logging breakpoints in Xcode4 that I'm using to selectively log things as I need them. However, whenever I make changes to the code involving adding or deleting lines, these breakpoints get out of sync with where they are supposed to be, sometimes even going to a completely different function.
Is there a way to keep the breakpoint in sync with the code, rather than just rely on the line number?
I believe it should, at least it's the IDE's usual behaviour.
Just a thought. Have you tried to reinstall XCode? I have experienced all sorts of weird bugs since the upgrade to XCode 4. For example, being unable to select a XIB file for a popup window in a project---and when creating a project from scratch, I was able to select that XIB and create the popup. At the time I posted a question on StackOverflow about this and it is still unanswered ever since.
Since that time, the project was overhauled and now I build my interfaces from scratch using full Obj-C code, dumping the interface builder 99% of the time...

Resources