"Find All References" broken in one solution - c#

At some point "Find All References" feature got broken for a single solution that I have. It works in all other solutions. For this one, it always returns "Search found no results"
What could be the problem?

In the old days (VC6 :) ) this type of problem was often fixed by deleting the .ncb file and letting it be rebuilt automatically. Not sure if this is still true in VS2005/8.

I would kill all instances of Visual Studio and try again. If this doesn't work, I would imagine that there really are no references to the type or member you are looking for.
Since this feature is working for other solutions I find it hard to believe that this is an issue with the IDE itself. I think the most likely explanation is that the IDE is correct and you actually have no references.
Do you have two types that are similarly named but not actually the same type? Can you find the references by text search?

Had the same problem in VS 2008. In my case it was because I was opening the web site as a project, instead of doing File - Open Web Site.

For me, I have been stumbled by "Search returned no results" but quickly realized that method name was Finalize(). Once renamed, all was well.

Related

Error while generating view in Visual Studio 2019

While I am creating an ASP.NET MVC view in Visual Studio 2019, I am getting this error:
There was an error running the selected code generator: 'the value -1 is outside the acceptable range 0,2147483647
How can I solve it?
We have to open vs-2019 and select tool -> Options-> General -> ignore GPU memory access exception if the data written didn't change. Mark it as checked then error will be disappear.
I ran into the same problem tomorrow, tried many manipulations found on different subjects, including yours, nothing worked. Finally, someone gave me a "solution" that let me continue my project, hence I'm sharing it here in case yours doesn't fit someone's issue: simply copy/paste any view...!
Yeah, it doesn't make the resilient error go away, and you'll have to hand code each new view, but at least you'll be able to keep coding your project.
Hope this helps.
You might want to check out my answer to this in:
the value -1 is outside the acceptable range of [0,2147483647]. Parameter name: value

Visual Studio 2015 not automatically adding asterisk for multiline comments

When typing multi-line comments Visual studio used to add an automatic asterisk to each new line of the comment as I press enter(apparently 2015 does not do this anymore). I really liked this. As of right now though, if I type "/*" and enter, Visual studio does not try to autocomplete it at all. In fact, it even lets me end the comment with "*/", too, instead of doing it for me. So my question is: is anyone else experiencing this? How do I get the original functionality back, so each new line is automatically prefixed with an asterisk, and closed for me by "*/"?
I already checked and yes, my environment settings are set to C# and yes the option "Generate XML documentation comments for ///" is indeed checked in my settings.
This is a well-known problem, the feature fell by the way-side in the Roslyn refactoring of the C# Editor Features. Nothing to do with config or a change of preferences, it simply was not implemented.
It is currently being tracked by this Github issue. Status is "Up for grabs" right now with nobody having shown an interest in grabbing it yet as of today. Afaict, best to not hold your breath for it, I think they have several bigger fires to put out. It will surely be delivered in an update sooner or later.
Just wanted to update and say that this problem was apparently fixed(sort of) in one of the newer updates of Visual Studio. The editor still does not complete the comment for you, but it does at least keep the formatting consistent, and adds an asterisk to the next line for you.

C# view source code of a particular .NET class

I browsed through some questions and this one stood out as the better one:
.Net Classes and their source code which pointed me to this place here: Microsoft Reference Source Server.
I tried everything the site says, downloaded a file that I cannot open from there and at some point ended up with a .pdb file in my source folder for the symbol cache that I could not open with a multitude of tools I looked into.
So this is my last resort to find an answer to my question. Out of pure curiosity (and lack of a better way to understand some stuff) I want to open a particular class from Microsoft (namely I wanna look into RichTextBox and maybe the classes it inherits from) but I simply cannot find a way to make this work for me. I want the original source, not a decompiler product because, well because I mainly need to understand some stuff, not see random variable names. I appreciate any help that may get me around my stupidity and clumsiness, as well as the right tools to do so (if any other than VS).
Note that I am using Visual Studio 2012 and yes, I went over a guide covering this specific version instead of the guide on VS 2008.
The "download" links on this page: http://referencesource.microsoft.com/netframework.aspx should work. However try downloading them via Internet Explorer; my Firefox attempted to download an .aspx file instead of the installer itself for some reason. (EDIT: as #ParagMeshram pointed out, just rename the netframework.aspx to netframework.msi as a quick fix if necessary)
In addition, here's a link to the source hosted by dotnetframework.org: http://www.dotnetframework.org/default.aspx/4#0/4#0/untmp/DEVDIV_TFS/Dev10/Releases/RTMRel/wpf/src/Framework/System/Windows/Controls/RichTextBox#cs/1305600/RichTextBox#cs
I can't say for certain if it's the latest greatest, or what you would be compiling against exactly, but should give you a good idea of how it works.

Visual Studio 2010 renaming project and main forms

I guess a lot of people start working on something. And then later they find-out the names don't really cover the end product. Or well at least, I do choose often poor names for stuff, I start programming faster then thinking about things like that (in the end I often rename my buttons too so my code becomes more clear too).
What is the best way of a current work in progress (not finished) to rename it? Without breaking the code, or do a lot after editing.
The reason I ask it here is I've seen it gone wrong a few times, leaving me code that didn't work any more so I better as how to do this and where in which pane, it's best to rename.
So what's wrong? Well in the upper right pane of Visual Studio 2010 C# (solution explorer):
The solution itself has a wrong name
The next line of it has the wrong name
And the main form could be improved too
If you were to rename the main form it would ask you if you want to change all references to it, you say yes and that problem is solved.
Renaming the solution is equally simple, just right click in the Solution Explorer and rename. It won't break your local build or anything.
I don't know what "The next line of it has the wrong name" is referring to (the project maybe?) but the same probably goes for it.
Well usually you should change the file name of your class in the solution explorer and it should ask if you want to change all references, though sometimes it can go wrong so to double check you can replace all command to find all references of old name and replace with the new one..
http://msdn.microsoft.com/en-us/library/139eef4h.aspx
Also if you change in code, the name of a class or variable or anything and then you should see small line under the changed name, stand with the mouse pointer on the variable and press ctrl+. (ctrl dot) And that shoul pop up small options and the first one should let you change all references of that variable new name also:
http://www.dofactory.com/ShortCutKeys/ShortCutKeys.aspx

Navigate files with VisualStudio 2008

I am currently developing with VisualStudio 2008. I find it increasingly difficult to find files when the number of files and projects increase. The situation become so bad that I literally have to spend 10-20 seconds to find code I want to work on when switch between files. Sounds like not a lot of time, but this can be very annoying because it breaks the "coding flow".
I believe this is a general problem with all IDEs. But I still find it easier to work with Eclipse. One particular example is that in Eclipse, I could apply some key shortcut to find implementations defined in an Interface.(I have forgotten which key shortcut though, after not working with it for about 1 year.) Another example is that in VS 2008, rightclick->Find all references will find all occurrences containing the selected text(Update: This accusation is incorrect. Thanks for pointing it out); while similar operation in Eclipse will find all occurrences where the selected class/variable are referenced. Personally, I find the Eclipse way is better for file navigation.
This could be due to my inexperience with VS IDE. So, I am looking for suggestions to improve the file navigation experience so that I can get some more time for actual coding.
I have used the navigate buttons but they are only useful for small number of files.
Thanks.
I agree wholeheartedly about ReSharper. If you don't want a "paid" solution though, a useful Visual Studio shortcut is
CTRL + ,
it gives a list of recently edited files.
CodeRush is a free alternative to ReSharper which you might find useful too.
Kindness,
Dan
Have a look at Jetbrains Resharper. Ctrl N or Ctrl Shift N. To jump quickly to files by type name or by file name. Also you can control Click Classes to navigate to them instantly.
I can't even work in visual studio without it anymore. It virtually eliminates the need for the solution explorer
SamTools for Visual Studio 2005/2008 (and I have a build for 2010 if someone needs it). The particular feature that's handy here is the Solution File List.
You can right click the tab of any open document and Find In Solution Explorer or Show In Windows Explorer
You can right click in the Solution File List for the same
Unlike other solutions to this problem, this is a properly docking tool pane so it fits in great. Ctrl+Alt+F places you in the Filter box with the current text selected, so it's very easy to work with.
Oh and it's free/GPL. :)
Solution File List http://wiki.pixelminegames.com/images/8/88/SamTools_SlnFileList.png
Dpack is also a free alternative with some nice file navigation shortcuts, but Resharper is the bomb.
BTW, they should have some more of this stuff in vs2010, which is in beta right now (I think)

Categories

Resources