TFS on VS2010, merging code issues - c#

Recently we have been having problems with TFS and our code base. We have a section of tests that use Webdriver, and a section that use Coded UI. Lately, we've been having problems merging our code after a new build has been pushed out. Some folders show up as a white outline of a folder, which we can right click and select "include in project". We also notice some files missing, and we can't "get latest" to grab them. We have to go some round about way to do it (shelve code, delete local files, get latest, merge code). Even when we do that we still have some issues.
But the main issue we are having is that our Coded UI maps are breaking. Instead of being the normal structure such as:
.uitest
----.cs
----.designer.cs
When we merge in the new code, the UI maps break out like:
.cs
----.designer.cs
.uitest
I opened the .csproj in notepad++ and noticed that both the .cs and .designer.cs files no longer have a dependancy of the .uitest file. Now the .cs file has no dependancy, and the .designer is dependant on the .cs file. We can fix it with relative ease, but it keeps breaking in every build and we have several maps we need to fix. What exactly could the problem be here? Also, referring to my frist problems of files not being included in the project, what could the issue be there?
I asked the same question on the MSDN forums, but the suggestions I have received I have already tried, like creating a new workspace since the other might be corrupt. Still didn't work.
Thanks in advance
Edit: Had a suggestion on the MSDN forums to run VS as administrator. That didn't work either. Not really sure what could be causing this issue. It doesn't seem to be causing problems for everybody because some new builds cause issues for some people but not others. Some more info would be I run on Windows 7 64bit and Visual Studio Ultimate 2010.

In the past I've had issues with TFS that sound similar, 2 of our developers seemed to periodically create problems when merging files into the data store, folders and files would show as not included while the project file would make it in (breaking everything after get latest). Eventually the problem went away but we never truly found the source. I believe it had something to do with our network - maybe a switch issue in combo with the way we mapped working folders to network drives pointing to a shared dev server. Also one of the workstations seemed to have a problem with windows explorer not seeing file updates on the dev server share... developer would have to hit \servername\C$\sharefolder then hit his mapped network drive again before updates would refresh. (And his check in's created the most problems) ... we ran VS2008, TFS2010
Just some ideas...

Related

100s of errors that all go away when I view them?

I have hundreds of errors saying type or namespace doesn't exist (some are types and some are namespaces). When I click to view the error it initially opens the file and shows the squiggly line under code in question, however within a second or two the squiggly line disappears and so does the error.
After I finish opening up all the files with "errors", all the errors disappear and it compiles fine. However, if I close any the files then the error reappears for that file.
This happened after I tried to merge branches. Not really sure how to proceed to find the root of the issue, or whether there even is a real issue... maybe this is just some bug in Visual Studio and I need to do something to clear some kind of cache to fix the problem?
Please advise.
Update:
I have tried all of tymtam's suggestions but to no avail.
However, after deleting the .vs folder, now the errors don't even go away when I open the files so I can no longer build by doing that either.
I am thinking the error may have something to do with dll versions or something like that but I have tried to rebuild and replace all dlls with latest ones and that hasn't helped either.
The problem for me was an outdated version of the .net framework. The new assemblies I was referencing were 4.8 based but my projects were targetting the 4.6.1 framework. Updating the project files to target 4.8 fixed it.
IntelliSense, which is likely the source of these errors, sometimes takes time to adjust to changes caused by switching branches (or more generally code changes that happen suddenly).
Here are the steps that should help, in order:
(Re)building the solution
Restarting Visual Studio
Closing Visual Studio and deleting .vs folder in the root of the solution folder.
Finally you can see if the errors are 'real' by changing what the Error List window shows to Build Only. I would recommend to have it as 'Build + IntelliSense' normally, and using Build Only only on special occasions.
Focus on the 1st error
More generally, when dealing with a large number of errors it's not a bad idea to look at the first one only, solve it, and build the code. A single syntax error can result in many errors and trying to solve the 2nd and subsequent errors would be futile.
In addition to the above, make sure you also look at the warnings (possibly information messages).
In my case, I had them turned off to focus on the errors only and missed the fact that my two projects were set to different versions of the .NET framework.
I did these two things to fix my problem:
I used WinMerge to copy files from the old branch over everything in the new branch for the application in question.
I updated the framework on the project to the latest version.
Originally, I did those two steps except I used TFS to merge the old branch to the new (instead of using WinMerge to copy/overwrite files) and accepted the old version for all conflicts.
This was the nuclear option as I lost any changes that were made in the new branch :(. I have a copy that I can use WinMerge to try to manually merge changes back in but it's definitely frustrating.

Build action is not supported

No code, since it's not a code problem, rather a visual studio one.
I've searched this problem up a bit and found people saying they had this problem, not really specifying how they got it, and most people answering "you should set AndroidManifest.xml's build actions to none" without any explanation of why this would work, which, well won't work for me since it's already what I have and I'm getting the error anyway.
How I came to have this problem:
I made a few files, file1, file2, file3, in my assets directory.
I would then read them with a streamreader. This worked.
Fast forward a few weeks, I decide to rename them, through visual studio, to file1.txt, file2.txt ... etc.
When I compiled/launched it on my device, it did not work. An exception on streamreader told me the file wasn't found. And before that I had 3 errors "#(Content)build action is not supported" for each of my files.
I assume the problem lies in the build actions or possibly the way android behaves with some specific files? Either way how could this have changed by changing the file format? I made them .txt files for clarity purposes, I didn't expect everything to break down after that.
Ontop of that, I could not revert it. I removed the file extensions, and I still have the same problem now.
What should I do to have my files in the assets folder properly deployed on my machine just like they used to ? Is it related to the build options?
Thanks in advance.
As highlighted by Jason in the comments above, the build actions for android assets should be AndroidAsset, which got changed after I renamed them. This menu can be found on the properties of the file.
https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/resources-in-android/android-assets?tabs=windows

Visual Studio Shows code errors that don't exist

I'm not sure if anyone else has encountered this but often, when I open this particular solution, I see a whole list of errors (see below).
If I double click one of them, then Visual Studio seems to wake up and the errors relating to that particular cs file disappear. This isn't a critical issue and is more on an irritation than anything else but I wonder, is there perhaps something wrong with my code that's causing this false-positive or is it random Visual Studio behaviour?
I had this problem too.
Deleting bin and obj folders not work.
Cleaning solution not work.
Various platform I need to be as is.
Helped me close solution and delete folder .vs, which is often full of problematic mess. After opening solution all false errors disappeared.
As mentioned in a comment, you can do a Clean and Rebuild. If that does not work for you, you can browse to the solution folder and within each of the project folders delete the bin and obj folders. Then perform a build.
You may also want to look into your Configuration Manager and ensure that all of your projects are set to the same Configuration (Debug/Release) and Platform (Any CPU/x86/etc...) and marked to build for that configuration.
Finally, you may also want to check the Build Order for your solution. Ensure that projects are all built in the proper order.
-- Edit:
On thing brought up in comments that I will add here was to make sure that any library projects in the solution are added as Project References rather than referencing the output DLL directly.
Something that has only become evident in later years, and is only relevant upon reflection on this old question, is that the particular solution that we experience this issue in contains a Website project and NOT a WebApplication project. This became evident when we started to look deeper into these recurring errors and noted that they only ever related to codebehind files and all had to do with the Control Name not existing in the current context.
Amongst the various differences between the two project types, it seems that the lack of designer files for each ASP page may be a contributing factor. The error disappears as soon as you double click it potentially indicating that VS is not able to keep track of the control references until you open the relevant page / codebehind file.
We're moving over to a Web Application as a temporary measure.
Hope this insight helps someone else!

VS2013 Intellisense constantly stops working

I have Visual Studio 2013 with no plugins or anything fancy. Whenever I'm coding, every so often (maybe once every half hour) intellisense randomly stops completing my sentences or popping up at all when I press Ctrl+Space.
I have tried Tools->Import and export settings->Reset all settings but it did not help. The issue came right back.
The only thing that solves it for me now is to close VS and reopen it. But as you can imagine, this is extremely frustrating.
I was having the same problem and this seemed to work for me.
http://omegacoder.com/?p=1008
Basically, go to Tools >> Options >> Text Editor >> All Languages >> General and make sure that both Auto list members and Parameter information are checked (not the half-checked/square state).
This is still happening in VS2013 update 4 (I have a WPF project using C#).
This was relatively easy to fix by closing then reopening the file not the whole project.
For me, Unloading and Reloading a project fixes MVC cshtml intellisense. Right-click project, click Unload. Right click grayed out project, click Reload.
Just to be clear, this problem only happens to me when in C# MVC views, only when checked into TFS.
I have also submitted this as a bug to Microsoft, see https://connect.microsoft.com/VisualStudio/feedback/details/932855/vs-2013-c-default-mvc-template-breaks-upon-checkin-to-tfs-2010
Looks like my issue cleared up after deleting the settings folder from my previous VS2010 installation. I followed the instructions here (Also applies to VS2013): http://www.haneycodes.net/visual-studio-2012-intellisense-not-working-solved/
In case URL breaks:
Open the start menu and type “%AppData%” and press enter to get to your Application Data Folder.
Either you were automatically placed in the “Roaming” folder or you weren’t. If you weren’t, go to the “Roaming” folder.
Open the “Microsoft” folder.
Open the “VisualStudio” folder.
Here you’ll see a folder titled “11.0” (the VS 2012 folder) and probably also “10.0” (the VS 2010 folder).
DELETE (or rename) the “10.0” folder. Note that you can now kiss your Visual Studio 2010 settings and preferences goodbye (your projects will be safe and sound).
DELETE (or rename) all other folders that are not the “11.0” folder, assuming you used to have Visual Studio 2008 or whatever.
Now restart Visual Studio 2012 and you should be good to go!
try to delete the .suo file of your solution. It worked well for me.
The first thing I should mention is that this hasn't happened since I've upgraded my RAM. I was at 4GB when this was happening. Often had multiple instances open as well as SQL Server.
I'm finding this seems to happen when I copy/paste controls on a page. Another side affect of this is that the designer.(cs/vb/xx) file is not updated right away and I don't have access to those controls in code behind.
I've tried a handful of things and here's a summary of what I've found so far:
If only 1 file/window appears to be affected, close/reopen that file.
If that doesn't work... in Visual Studio:
Click Tools->Options->Text Editor->All Languages->General
Uncheck "Auto list members"
Uncheck "Parameter information"
Check "Auto list members" (yes, the one you just unchecked)
Check "Parameter information" (again, the one you just unchecked)
Click OK
If this doesn't work, here's a few more steps to try:
If still not working, close all windows and reopen
If still not working, close/reopen solution
If still not working, restart VS.
(I haven't yet figured out why more drastic steps are required in some cases.)
For C++ projects:
MSDN has a few things to try: MSDN suggestions
The corrupt .ncb file seems most likely. Note that in VS2013 and later, it is the .sdf file, which can be found in the root folder. Try searching for filename:*.sdf.
From MSDN:
Close the solution.
Delete the .ncb file.
Reopen the solution. (This creates a new .ncb file.)
Notes:
Tested in VS 2013/2015
Logging possible causes:
Copy/pasting controls in a source page. I found that my designer.vb file didn't update from this, either.
Copy/pasting code from another page that caused an error because the code copied referred to a control that wasn't on the page I was pasting to.
C++ project has corrupt .ncb file
Like cacau says, you must first do a clean of the entire solution. Then restart VS rebuild the entire solution.
This sometimes happens when you are using Entity Framework or WCF services (Or the combination)
VS generates a lot of files then that contain code (the service reference for example). When you regenerate that code (And for example you are running a web project) sometimes you forget to stop the site. Then VS can't overwrite every file. Resulting in a global intellisense failure.
For me, the problem happens when I have two instances of same solution opened. On one of them I'm running Tests, while on the other I am making tweaks to code. Intellisense will quit working on me usually after I've run some tests and stopped the debug session manually.
The solution for me is to close all VS windows and reopen...
Did you try a clean build on your project?
VS might have become confused with some of its generated files..
None of the solutions in this thread worked for me.
what worked was that I deleted everything in the packages folder. when I rebuilt the solution, nuget got the latest versions of all the folders I deleted, and intellisense started working fine.
If I am not mistaken, the problem initially was caused by the contents of the "Microsoft.Net.Compilers.1.0.0" folder, but I dont know why.
If you have this problem in one file, make sure that this file is included in your project. Right Click the file, Select Include In Project. If the file is not included in your project, VS will treat it as a normal text file.
I followed the instructions given in response to the question : Visual Studio 2012 - Intellisense sometimes disappearing / broken (thanks to SajjadHashmi and others). I've copied the steps I followed (which worked for me) here in an attempt to be helpful.
1: Close all the tabs and open your file again. (Thanks to russds)
2: Clean the Build > Close the Solution > Restart Visual Studio > Open the Solution again
Further steps are listed if you follow the above link but some seem to no longer apply to Visual Studio 2013 (e.g. refresh Local Cache for intellisense).
I know that these steps involve restarted Visual Studio (which you are explicitly trying to avoid) but for those who find your question (such as me) a potential solution might be useful.
In case anyone else fell into the black hole I did ... I too suffered from this issue but NONE of the above solutions worked for me. Eventually I figured out that somehow the opening <body> tag had been deleted from my .Master page and that was causing all my .aspx pages to lose 95% of the Intellisense code hinting. Once I added the missing <body> back to my .Master page, the Intellisense finally started working in my .aspx pages again! Hope this helps someone ... just cost me 1.5 hours!
Sometimes none of suggestions here works - at least that happened to me.
But don't rush with configuration resetting, cleaning up visual studio configuration files and so on. If clean/re-build + vs restart does not work - problem might be in code itself.
In my case (vs2013) I had C++ class exposed in .h like this:
class MyClass: ...
{
....
DLL_EXPORT returnArgs function(InParameters)
}
where DLL_EXPORT is defined as :
#define DLL_EXPORT __declspec(dllexport)
Same function in .cpp:
returnArgs MyClass::function(InParameters)
{
}
vs2013 was refusing to jump between function definition / implementation.
Reason seemed to be DLL_EXPORT macro - I've written function like this:
DLL_EXPORT returnArgs MyClass::function(InParameters)
{
}
After that intellisense started to work again.
It's possible also to remove that define or wipe it out - according to visual studio documentation __INTELLISENSE__ - but that define did not work for me for some reason. Code snipet like this:
#ifdef __INTELLISENSE__
#define DLL_EXPORT
#else
#define DLL_EXPORT __declspec(dllexport)
#endif
Please comment if you understand why this does not work.
In vs2015 this issue seems to be fixed, but there are other problems with vs2015.
None of these things worked for me. After lot of struggle I found why it was not working for me. I always had multiple solutions open in my machine. For suppose, One solution is for front-end layer and another solution is for back-end layer.
When it hits breakpoint kept in backend service layer intellisense was not showing up. After I closed all other solutions and rebuild the solution where I wanted to debug, everything worked fine.
There could be other reasons, but this worked for me and wanted to let this community know and it may help someone.
EDIT: Few times "delete all breakpoints" and adding again worked.
I had the same problem and in my case it was the same file being open twice. For example I have dev\include\myfile.h AND dev\include\myfile.h\ (note the backslash, making this a unique string).
This happens when I use F12 to find a symbol in an include file, but also have the original .h file open already; Visual Studio opens up a duplicate file, which is really the same file.
When saving either of the two instances, the changed file date will be noticed and I get a popup asking whether I want to reload the other instance. More problematic seems that it also confuses IntelliSense. I just tried closing all duplicate instanced files, and IntelliSense started working again without restarting or reloading anything.
I tried to fix my problem by solution VS2013 Intellisense constantly stops working
But it did not work for me.
Solution that worked for me is off/on Auto list members
Go to Tools > Options > Text Editor > General

SVN keeps corrupting files with "<<<<<<< .mine", how to fix?

I've got a Visual Studio C# project which is under version control (SVN).
I've always commited and updated the project without any problems. But a couple of hours ago Visual Studio throws the following error when I try to launch/rebuild the project:
Files has invalid value "<<<<<<<
.mine". Illegal characters in path.
I don't know how to fix this problem. What should I do?
That happens when svn encounters a conflict: You changed a file, the file on the server was changed and it cannot (easily) be merged automatically. You need to decide what is the correct solution now.
Subversion just adds the diff into your source file (and creates files next to it, called OriginalName.mine (unchanged) and OriginalName.rsomething (unchanged, server version)).
Fix the conflict and tell subversion that this is resolved.
just delete the obj folder and it will worked fine.
Remove the code that shouldn't be in the file throwing the error and remove the the three files with extensions .mine, .<somerevision> and .<some_other_revision>. svn updated files that now contain 'conflicts' and you need to resolve these conflicts by hand. Usually this means you edited a file, someone else edited the same file and checked in changes and you didn't pay attention when checking out the changed file.
Delete every thing you have in obj folder .
Remove your obj folder from svn version control . Because on every build it get updated and when other developer commit changes to solution SVN is unable to marge obj folder files and raise error
Files has invalid value "<<<<<<< .mine". Illegal characters in path.
Please read the Basic Usage chapter in the subversion book. It has a section about Merging conflicts by hand which explains the conflict markers you're seeing.
Removing the debug folders worked for me (see comment-not answer above).
I got this after moving 12 folders from one section of svn to a new section. So if you get this after moving a project and the error does not point to an actual file, this is likely your issue.
If you have AnkhSVN or VisualSVN installed resolving this is most likely as easy as right clicking the file in the solution explorer and selecting edit conflict.
This will open the changed file in your merge editor. (See Tools->Options->Source Control->Subversion User tools for AnkhSVN). With a good merge tool like the free to use SourceGear DiffMerge or TortoiseMerge, resolving the conflict is just a few mouseclicks away.
I have had this happen on a large scale where the files get marked resolved but the conflict metadata is still there. I wrote a regular expression for visual studio to find these, for instances where it is not feasible to simply revert the changed files.
http://www.codetunnel.com/blog/post/90/ever-merge-with-svn-and-mess-up-when-resolving-conflicts-read-on
I closed the IDE, then deleted the obj folder and restarted the IDE and rebuilt my Code. This worked for me.
Inside your project :
odj folder -> Debug -> project name.csproj.Filelistabsolute.txt(snb.csproj.Filelistabsolute.txt)
Inside the text file
>>>>>>>.mine and >>>>>>>.r150 occurs
to remove the things the program works
1)Just save your local changes whatever u have edited in the file
2)revert the file
3)update it from SVN
4)Paste your local changes
If you are using TortoiseSVN you should have a right click option on the file called Edit Conflicts. This should bring up TortoiseMerge which is able to read those obnoxious notations stuck into the file (really, to break your code so you KNOW there's an issue and don't blindly check it in).
TortoiseMerge will read it properly and present you with a 3-way merge. This was what I was looking for. Although it is true that it does also create the separate .mine and .rxxx and .ryyy files, and there are various manual and command-line ways to deal with all this.
Have a simple solution. just delete all file from debug folder and rebuild the solution, an error display on the screen "There were build errors. Would you like to continue and run the last successful build? click on "Yes" button. Now stop the program and run normally.

Categories

Resources