Long load time in Visual Studio for Large Project - c#

Is there a way to turn off intellisense in Visual Studio 2008? I know about deleting a DLL to turn off intellisense in C++, but that doesn't work for C#. I also know about the preferences but that just turns off the visual display. I want to turn off ALL of intellisense so it does not scan my code at all.
Update 10/14/09: Eric was kind enough to take a look so I sent him some log info. I'll post the resolution here when we get one.
Update: updated title to reflect the changed direction of the thread
Related Question
Turning off Intellisense for a single project in Visual Studio 2008

The guys on the VS team looked at this for me and found a problem with intellisense. Here's their description:
"It looks like both of the files you gave me contain a part of static partial class EntityPropertyDescriptors, and I would guess that all the rest of the 500 files do too. What’s happening is that as we build up our IntelliSense cache, each time we parse one of these files, we see that it has a static class in it, and we decide to see if that static class has any extension methods. In order to look for the extension methods, we look through each method in each part to see if it’s an extension method. This causes us to reparse every file in order to see if the type has any extension methods."
They found a similar problem with VS2010 but are fixing it now. Unfortunately, they are not going to fix it in VS2008, so we are left with the workaround of putting all the partial classes into a single file. They can still be partials, but they must be in the same physical file to get around the problem.
After combining all partial classes into a single file, load time for this problem project when from 30 minutes to about 10 seconds.
Big thanks to Eric Lippert and Kevin Pilch-Bisson for helping me with this.

You need to switch off background compilation.
Here is a HowTo:
http://ira.me.uk/2008/09/01/switch-offon-visual-studio-2008-background-compilation/
Tools -> Options -> Text Editor -> C# -> Advanced -> Show live semantic errors
You will still get error underlining, but you must hit the Build button before they show up.

In tools > options > Text Editor > C# there is a Intellisense section which looks like it does what you want.

Have you tried cleaning your solution from all temporary files created by Visual Studio? Sometimes these files could get corrupted, the chances might especially be high if you migrated from VS 2005.
Close your solution, look for all *.suo and *.ncb files and remove/rename them, and then re-open the solution.
Just another thing to make sure: Are there any third-party add-ins installed? Try to start VS in SafeMode using the /SafeMode command-line option.

Related

Visual Studio C# Tab Auto Formatting Going Backwards

After searching for a very very long time, I still haven't found an answer. Basically anytime anything is done with tabs in Visual Studio in C#, things go very badly (see attached gifs, note that the two initial tabs are for a namespace and class). These issues only happen in C# as far as I can tell, as I've used Visual Studio as my main IDE for C++ development and haven't had these sorts of issues. I've attached what I think are relevant settings screenshots.
In the attached gifs, there is only one line that the bug is shown on, but things get very nasty if I attempt to copy multiple lines...
Any help would be massively appreciated!
Not saying this is your issue ...
But starting with VS2019 an .editorconfig file can be generated and its settings saved to the project. I would check and see if one exists.
Code style rule options

Visual Studio Intellisense not showing some classes

My Visual Studio is not showing a lot of the available classes in the IntelliSense auto-complete. For example, a project I'm working on has a reference to the Microsoft.Xna.Framework namespace, yet even after adding the using statement using Microsoft.Xna.Framework in a file, IntelliSense is unable to recognize classes like Texture2D and Rectangle. I can still type them in, however, without getting a compiler error. Any idea what's happening?
The IntelliSense detects standard libraries like System.Diagnostics but not any external ones.
It is not a NameSpace conflict issue because classes within the current namespace are also missing from the IntelliSense.
I have tried:
Restarting Visual Studio (With and without closing tabs)
Deleting the contents of %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentCacheModel folder
Resetting import and export settings
What worked for me is unloading and reloading the project
If unloading/reloading the project doesn't work, try deleting the .suo file found in the SolutionName/.vs/ folder. The .vs folder is an auto-created, hidden folder so you will have to show hidden folders in order to see it.
I am using ReSharper. What worked for me:
Unload project.
ReSharper > Options > Environment > General > Clear caches
Close solution.
Exit Visual Studio.
Restart Visual Studio.
Reload project.
Do you have ReSharper or any other plugins installed? There sounds like a similar issue/solution here. It may be third-party plugins at play depending on what add-ons you have.
Try saving and reloading the files.
I don't know why it happens, but it happens to my work laptop occasionally, typically reopening the source file resolves it.
OK so probably not the best solution but it works. I reinstalled Visual Studio and the problem was fixed. Also, it hasn't shown up since (this happened about 3 months ago).
another dumb solution))) Determine which classes/namespaces are not showing up. Then go to that project where they are. In that project pick any .cs file copy its contents, then delete that file and create again))
Click on the class not showing and Change Build Action -> to Compile
it happens sometimes when you add class as content or other resources

Locking files when building in Visual Studio 2010

Hello there, Stackoverflow.
Recently, when I've been programming in Visual Studio 2010, I've been getting the problem with VS locking the bin/Debug/(ProjectName).exe file when trying to build and gives me the error below after trying to build the project 10 times:
Unable to copy file "obj\x86\Debug\TileEngine.exe" to "bin\x86\Debug\TileEngine.exe". The process cannot access the file 'bin\x86\Debug\TileEngine.exe' becuase it is being used by another process.
The problem appears when I edit the source and then try to Debug.
I've checked using different programs, and the only program using the file is Visual Studio.
If I wait for about 10 minutes before trying to build, it seems to work properly, but when trying different things, it isn't good needing to wait 10 minutes before trying something.
I've tried different solutions both on this site as well as everywhere I can find on Google.
Some solutions I've found, but haven't worked for me
Solution 1 - Using a pre-build script
In some different questions here on Stackoverflow, I've found one solution being that you go into Project Properties > Build Events and then in the Pre-build event command line add:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
This made it possible for me to build the project one more time than I usually could, but when editing the code again, and then building, the same error appeared.
Note: Trying to build a release instead of a debug build seems to break the pre-build script and it exits with the code '1', which seems to make VS unable to build properly. Removing the pre-build script makes it work like "normal" again, still with the same error though.
Solution 2 - Running Visual Studio as Administrator
This is another solution I've found, but havent worked either for me, so I assume that Visual Studio already have all the permissions required and running as Administrator doesn't actually make any difference.
Solution 3 - Changing the AssemblyVersion
In this question, Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug, I found another solution that included changing the AssemblyVersion, in the Properties\AssemblyInfo.cs file, to "2.0.0.0".
This, however, haven't made any difference whatsoever for me.
Solution 4 - Closing UserControl designers before building
According to some different answers here and there on the Internet, Visual Studio apparently uses the built project executable to render the UserControl designer(?). In my case, this is probably not it, though, since I use XNA mostly and it doesn't use the UserControl designer.
Solution 5 - Cleaning up resources when application quits
This might be a solution that I have failed to implement properly. I'm just thinking though, that if this is the solution, how come I haven't been required to do it before. I assume XNA unloads everything that gets loaded through the Content pipeline, therefore this solution wouldn't' make any real sense.
If there is anyone that is able to spread some light on this issue, it would be really awesome, as it is stopping me from programming anything really, because I don't like waiting for 10 minutes because I've made a 2 second change all the time.
I've run into this problem a few times myself.
Mine might not be from the same cause as yours, but I'll tell you what went wrong with me and how I fixed it, hopefully it'll be helpful to you.
Basically, my program never fully exited properly, even when it appeared to. It would continue to run, and thus continue to lock down the file.
A quick dirty fix I used initially (and a way to prove if this is the case) is:
Open Task Manager (Ctrl-Alt-Del)
Click Processes tab
Look for your program's name (TileEngine.exe)
Note: There will probably be name_vshost.exe (TileEngine_vshost.exe) That's a VisualStudio thing, ignore that, it's not relevant.
If you find it, it means your program hasn't actual exited fully.
If it's there, click on it and press "End Process"
So if it's there, then for some reason, your program didn't shut down, like mine did.
Often, this is from a thread being launched and forgotten, or an Async task that never completes, or something like that.
Make sure in your OnExiting(..) void function that you kill all running threads.
If your program is still running despite best attempts to close all threads and other blockers, you can use the very dirty bad method:
In OnExiting(...) run the code "System.Diagnostics.Process.GetCurrentProcess().Kill();" - this will taskmanager-style forceshutdown the current process... this is only as an emergency I-can't-make-it-work-any-other-way method.
I think I found the solution myself.
In the Project Properties, "Enable the Visual Studio hosting process" wasn't checked. Checking it seems to have fixed the problems, at least for now.
Got reminded of it from mcmonkey4eva's post. So thanks for that =)
And thanks for the other replied I've got. Stackoverflow is awesome!
Have you checked if any files are being blocked by your firewall? When I switched to the full version of Avast I find I have to disable the File System Shield It loves to remove my executable files when I try to run my visual studio projects.
I had problems when upgrading to VS2012 Professional. (SDK, .Net, Visual C++ Redistributable package)
ENSURE ALL OF THESE ARE COMPATIBLE WITH THE CURRENT VERSION OF VS YOU ARE USING
What I did, was I ended up uninstalling EVERYTHING that was associated with both Visual Studio downloads. If you are able to remove and save your project files elsewhere and then bring them back. Go through all your program files to see if there is anything hidden in the wrong folder and check your C drive.
Which meant downloading and reinstalling (fresh):
I think if you clean out your program files, it should be ok. I wouldn't recommend going into your register unless you are very sure of what you are doing. IF you have already made changes to the register then we'll have a look at that and other options (if this doesn't solve your problem).
Try removing the readonly check from your solution by unchecking at the folder level.
I ran into this problem and in my case was due to having bin included in the solution; as soon as I excluded the bin folder from my solution the problem went away.
Nothing helped, not prebuild commands, neither designers closing, but I figured out a way that helped me, just changing from debug to release and vice-versa releases locked files and you can delete them without closing the IDE.
I regularly get this problem if I switch from Debug to Release and then immediately F5 to compile. Crazy as it sounds, waiting for, say, one minute after switching between modes will prevent this.
If it's locked, the only solution is to close Visual Studio and re-open.
I solved this problem organizing my resources on solution. I noticed this error when I put some images on my application at the same solution folder.
So,
I'd removed all images and resources from app, save without it.
Moved the images to outside Solution folder.
Open the solution and add this images again, using "Import" button at controls.
If you will try this, remember to do with Application Icon, on Project Settings.
Now, everything is working fine for me.
I hope it helps.
You need to disable Windows Indexer as it locks up the file
Follow this Guide how to disable
In my case the problem seem to be caused by the remote debugger. It starts on local machine when you compile with "x64" option. Try to change the project setting (properties/buid) until you reach the final version.
Change Build Platform target from x86 to Any CPU.

Cannot debug under Visual Studio Express anymore

I used to be able to debug using Visual C# Express 2010 with no problem before. However, since I've opened my project using MonoDevelop (to port it under MacOS), I can't seem to be able to debug anymore.
The exact error message is available below:
A lot of people says to go in the configuration manager, which I'm familiar with, however, I can't seem to find it in the Express version.
Since you didn't have this issue prior to opening in Monodevelop, it more than likely changed something within the solution and/or project files. There are a number of posts on stackoverflow...
stackoverflow: no symbols
stackoverflow: no symbols when crossing module boundries
(From Răzvan Panda comment on the question)
... that talk about missing symbols. However, based on the information provided about monodevelop, I'd venture to guess that the IDE changed something within the solution and/or project files.
If your solution is under source control and you don't see any differences in these files, let me know. Otherwise, you could create a new blank solution/project file (from Visual C# Express 2010) and re-add all your files to it to get the default settings back and see if that resolves your issue.
EDIT: Also, keep in mind that there are ".user" files that I guess "might" have an effect on build/debugging configurations. If re-adding your files to blank solution/project files doesn't work make sure all the "extra" files like ".user" are not in the directory. Usually files like ".csproj.user", and ".suo". I've never had an issue deleting these they store local configuration changes that are not usually checked into source control.
I had same problem with Symbols when I added some dll to my project so what I did was to manually adding them. you can try going to tools > option > Debugging > Symbols and from there you can add the file root (in this case monoDevelop) and it automatically looks for all .pdb files and adds them to your environment. After rebuild it should be Okay.
Cheers
As George Duckett said:
Re. configuration manager, enable expert settings first. Tools->Settings->ExpertSettings. Then find it under Build->ConfigurationManager
Then changed it to Debug.

Code changes not being included when compiling in Visual C# Express 2010

At seemingly random times, whenever I load up VC# Express for the day and start working, any changes I make to my code don't get reflected in my debug runs. It's as if VC just refuses to compile the code and just runs the old already-compiled version. Deleting the "bin" folder in the project directory doesn't help, as then VC just complains that it can't find the *.exe instead of recompiling. Doing a rebuild helps, but only for that one rebuild, so I'm continuously having to rebuild the solution to see any changes, which is really slow.
The only way I've found to get rid of this problem (for maybe a week or two) is to create a new project and manually copy over my code. Needless to say, this is really frustrating and tedious. Is this a documented issue? What can be done to fix it? Searching online doesn't really turn up any answers, as the search terms most applicable to the problem bring up a lot of noise results.
You might see if the project you are working on is set to Build when the solution builds. To check this, right-click your Solution and go to Properties. Click the Configuration Properties node on the left and make sure all of the projects you want to build are checked on the ride side for your given build type.
UPDATE: Also, what is the timestamp on your build files? Is the timestamp getting updated on your build?
I had this problem when working on a network drive, and the time on the server was out of sync. Linux+Samba accessed by Win7 Pro and VB 2010 Express.
Correcting the time-difference solved the issue.
click on BUILD-->REBUILD SOLUTION and you are now good to go

Categories