Broken Intellisense in One VS2010 Project - visual-studio-2010

I have a solution that contains several projects, and all but one project loads full intellisense. The one project left is a C# class library and does have some intellisense, so I still get simple syntax and structs, but nothing useful like ObservableCollection, Go to Definition, list members, or parameter info. I can't even get intellisense on the properties in the current class.
Is there a log somewhere of what error caused intellisense not to work that would help me in this case?
Here is a list of the things that I have tried and have not worked for me:
Restarting my machine
devenv /resetuserdata
Tool -> Options, Text Editor -> All Languages -> Auto list members is selected

I gave up on the project and started a new project file, which worked. The only thing I can figure is that the project file got corrupted. When looking at the differences between the old file and the new file, it looks likes the structure encompassing many of the files was changed, possibly a difference between VS2008 and VS2010.

Related

When opening a script from Unity, Visual Studio opens the wrong solution

I have multiple Unity projects on this PC, however this problem only affects one of them, the one which is connected to Plastic SCM named "My Daughter's Adventure". Please ignore the name :). If I try to open a c# script from Unity, it opens it like this. However, the correct .sln file does indeed exist in the correct folder, shown here.
If I try to open one of my "offline" projects, everything works fine. Image here.
Now, I can open the .sln file manually and then open the script file from Unity. That brings back Intelisense and that little code dropdown menu, but this method has been kind of bipolar. Sometimes everything works fine, otherwise I get errors in Unity regarding the name of the script that doesn't correspond with anything and it asks me fix "compile errors" even if there aren't any.
Do note that I tried everything, at least what I could find online in terms of fixing this, including the preference settings in Unity. I'm also kinda new to Unity and Visual Studio. It took me 3 hours just to identify the problem and made an account just for this problem. Can anyone help me?

What does the 1st dropdown in the code window really mean in Visual Studio 2013?

I have a large legacy solution with several projects in it and I was looking at the 1st dropdown in the code window. I thought that it referred to any other projects that use the same file that was currently displayed, but it appears to be doing something different. The hover text states
Use the dropdown to view and switch to other projects that this file (filename) may belong to.
That may part is what I think is a cop out to say that VS may get confused sometimes. Am I wrong?
What I am seeing for the stdafx.h file in my projects is that from project 1 it shows project 1 and project 2 in it, but when I go to project 2's stdafx.h (which is a separate physical file), it shows project 1, project 2 and a whole lot of other projects.
If I am wrong, what is this trying to tell me?

There appears to be a discrepancy between the solution's source control information about some project(s) and the information in the project file(s)

I get this error message in a Reporting Services solution in Visual Studio 2010 [we're using TFS for source control]:
There appears to be a discrepancy between the solution's source
control information about some project(s) and the information in the
project file(s).
To resolve this discrepancy it will be necessary to check out the
project file(s) and update them. If the check out fails, however, and
the solution is closed without saving, you will see this warning again
the next time you open the solution.
Only some projects get checked out but others seem OK. So here is what I tried:
I tried to compare what might be different between the project
files that work and don't work but nothing catches my eye.
I looked around and tried a
number of proposed solutions like "adding a file, checking in and then removing
it and checking in". No luck.
I tried to look for "Scc" tags in project files
but I don't see any in there. I also don't see them in projects that
work fine. Looking at my solution the Scc entries look reasonable.
Help!! What am I missing?
Using Visual Studio you can solve this problem by unbinding and binding the solution and/or projects. Try this:
Open the problem solution in VS (did this in VS2013 just now)
Undo all pending changes to all the projects in that solution and the solution itself
Go to File -> Source Control -> Advanced -> Change Source Control
Select the problem projects and click "Unbind"
Click OK and close the window (THIS IS IMPORTANT - if you don't click OK VS doesn't update the solution properly)
Go to File -> Source Control -> Advanced -> Change Source Control
Select all the projects you unbound in #4 and click "Bind"
Click OK and close the window
Check In Your Changes
Close the solution and open it back up and everything should be fine now
Experienced the same problem in VS2015.
I found this workaround worked for me:
Change < Scc* > tag values to "SAK" (Should already know) in the project files:
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
https://connect.microsoft.com/VisualStudio/feedback/details/616751/discrepancy-between-the-solutions-source-control-information-about-some-project-s-and-the-information-in-the-project-file-s
Workaround #3
There was 1 person on our team who was doing the conversion to TFS from VSS who didn't have any errors. He never checked in his solution so we never saw it until now. I looked through his solution file and there are differences. I found the following differences for each project in "GlobalSection(TeamFoundationVersionControl) = preSolution":
Our NETReports.sln in TFS (the file that gave the error above):
SccProjectUniqueName7 = EllinReports\\DiagnosticReports\\DiagnosticReports.rptproj
SccProjectName7 = EllinReports/DiagnosticReports
SccLocalPath7 = EllinReports\\DiagnosticReports
His NETReports.sln (the file that DOESN'T give the error above):
SccProjectUniqueName7 = Reports\\DiagnosticReports\\DiagnosticReports.rptproj
SccProjectTopLevelParentUniqueName7 = NETReports.sln
SccProjectName7 = Reports/DiagnosticReports
SccAuxPath7 = http://<server>:8081/tfs/dev
SccLocalPath7 = Reports\\DiagnosticReports
SccProvider7 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
I guess it all makes sense now. We were all missing the SccAuxPathXXX, SccProviderXXX and SccProjectTopLevelParentUniqueNameXXX. Having them made the difference.

How to solve Intellisense not working in VS 2010

I am opening files from a server ASP.net and the VB codebehind files, and my visual studio is not working correctly, Intellisense is dead and if i right click the "Go to defenition" option is disabled. These files are not part of a solution.
This is strange though because it was working properly yesterday. If I create a new project the intellisense works great, yet opening this single file it fails.
I have tried to re enable intellisense by resetting visual studio, I tried editing the text editor settings so that Auto list members and Parameter information are both checked. I even tried installing ReSharper and nothing worked. I have rebooted twice and even tried copying the file to a local drive to work on yet nothing.
Does anyone know why this is happening and what I could do to solve the problem? Im working on a rather complex problem and intellisense would make it a lot easier.
I managed to fix this problem which manifested itself after my ReSharper trial expired.
Steps to fix are:
Tools/Import and Export Settings
Reset all settings
Back up your config
Select your environment settings and finish
Intellisense started working again straight away.
For me simply hitting Ctrl+Alt+Space to re-enable Autocompletion fixed it.
I had the same problem. It only affected one of my solutions. Others seemed fine.
To correct it I deleted the solution's user options file (.suo).
When I opened the solution again, intellisense was working.
For the benefit of searchers, Nicks suggestion is good, but if you don't want to reset all your settings, you could follow the recommendation in this post.
It states - "go to "Tools | Options | Text Editor | C# | General and check the "Auto list members" and "Parameter information" checkboxes"
I should first note that upgrading my RAM from 4 to 16GB seems to have made this issue go away.
Here's the steps I go through:
If only one file/window appears to be affected, close/reopen that file. If that doesn't work, try below.
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:
Close all VS documents and reopen
If still not working, close/reopen solution
If still not working, restart VS.
For C++ projects:
MSDN has a few things to try: MSDN suggestions
The corrupt .ncb file seems a likely culprit.
From MSDN:
Close the solution.
Delete the .ncb file.
Reopen the solution. (This creates a new .ncb file.)
Sometimes, it could be because of different extension style that you are using for the files.
In my case Intellisense is working in all the files except for a file in a different project of the same solution.
When I have changed the extension of the file to cxx from cpp,it started working.
The includes and other files in the solution are of extension .cxx or .txx.
Thank you
Save your solution. Closing the VS2010 instance for this solution and re-oprning worked for me.
Here I assume that Intellisense was working OK but stopped for some unknown reason without changing any default settings.
Prabhdeep
After uninstalling ReSharper, the squigglies that show up underneath a syntax error stopped showing up in the code editor.
This blog post helped me fix the issue.
Try this:
Close any open instances of visual studio, delete the folder 10.0 inside `C:\Users[username]\AppData\Roaming\Microsoft\VisualStudio\' and restart the visual studio. Issue will be fixed.
In my case, none of the above worked (although I discovered that sometimes the *.suo file is the trouble maker - in those cases deleting it helps).
I fixed it successfully the following way: Let's assume your solution has the name MySolution. Do the following:
Reset the settings (as described here). Close Visual Studio 2012.
Locate the file MySolution.sln.DotSettings (it is in the same folder as your MySolution.sln file)
Rename or delete it (for example rename it to XMySolution.sln.DotSettingsX so VS won't read it)
Open your solution by double-clicking on the MySolution.sln file
And afterwards Intellisense was working again just fine. I assume the file MySolution.sln.DotSettings got corrupted.
Note: The file MySolution.sln.DotSettings was created and checked in to TFS by a team colleague who had installed ReSharper. The issue occurred on a different PC without ReSharper where the same project was opened.
For me, this was related to an incorrect xaml file build action in an Azure WorkerRole project (bizarre, though it may seem!). Please see my entry in this post if you want to know more:
C# VS2010 Entering break mode failed
The fix for the error in the above thread also resulted in the intellisense starting to work again.
I fixed this problem by removing Sybase Power Designer VS extension.
You can try to disable other extensions.
Exactly the same issue, though would appear only on certain projects (even within a single solution).
Removing the *.*proj.user file (e.g. *.csproj.user) for the projects in question properly reset the missing features ("Go To Definition", "Organize Usings", Intellisense on certain types, etc).
In our case, I suspect this happens sometimes when we switch branches with an SCM that uses a single working directory (like git). If setup properly, it wouldn't track *.user* files but that means that if there are incompatible changes in it across different branches, you need to regenerate it.
So of course the "sometimes" would depend on the current branch and the next branch.
Unfortunately I don't see a very good solution if that's the case. Sometimes you really want to keep the user settings across branches if they're compatible, sometimes you want to regenerate them unconditionally. Ideally, you might even want to only change parts of them when switching, while keeping other parts.
If you never need to keep them and are fine with regenerating them every time, then you can configure your SCM to always remove these files while switching branches (e.g. using hooks for git). This is a pretty naive solution however, doing it more universally correctly would require a smarter system (aware of the semantics behind the .user files and capable of capturing/prompting user intent when needed).
save, close and reopen the source file you are working on. This works every time for me.
Try to add the statement:
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="IP_Updater.Default" %>
...at beginning of your page. The above example is applied for page Default.aspx written in VB.NET.
This is the problem related to Microsoft MSDN , your MSDN might be getting some problem. The solutions to this is uninstall MSDN and then re-install . before going for this make sure that you system is free from virus attack.
Hope that after doing , the Microsoft Intellisense will start running

How to make Visual Studio ask for the source path after I get: "There is no source code available for the current location."

Sometimes, in debugging mode, I try to watch code at some level of the call stack, and I get an error:
There is no source code available for the current location.
I know what it means. If I know where the file is, how can I give the source file to Visual Studio?
The first time, it gives me a browse window for search, but at this time I didn't have the code. When I downloaded it from SVN and tried (after restart of the whole computer) to access the code again, I get the error.
Please don't explain me that Visual Studio can't find the file and because of it gives disassembly, I know it. I searched for the option to give it the file.
In Visual Studio (at least since v.2005) you have to check the Solution properties:
In the Solution Explorer, right-click on the Solution -> Properties -> Common Properties -> Debug Source Files.
There is a list here: "Do not look for these source files:" - remove (all) entries from this list, then VS should ask you for the source path again.
Here's a screenshot from VS 2013 Express:
None of the above steps worked correctly in VS 2013 for me.
After removing the incorrect source path from the Solution -> Properties -> Common Properties -> Debug Source Files list, closing all instances of Visual Studio, each time I ran and stepped into the code, I would see a file dialog would pop up and go away and then VS would step to the incorrect source location again.
After numerous attempts at this, I used a hex editor to do a Unicode string search and found the offending path was still in my solution's .suo file. Deleting that file still did not fix the problem.
Finally, I opened the solution again, went to the Solution -> Properties -> Common Properties -> Debug Source Files list and changed the incorrect source location to the correct one (i.e. instead of deleting it). I then Ctrl+Shift+S to save all, exited VS, started VS again and started a debug session. This time it stepped to the correct code.
So, if the above is not working for you, there's an issue in VS 2013 with it caching the path that prevents deletion from working and you must change the existing path.
If I remember correctly, if you fail at the task of locating source code when it first occurs, the modules are added to the excluded modules list.
Go to Tools -> Options -> Debugging -> Symbols. Under "All Modules, unless Excluded", there's a link button "Specify Excluded Modules". Open that dialog, and I think you'll find your modules in there.

Resources