having large .cs files lowering the performance - c#

I have 100 and above in my cs files in my cs project file , and it is very slow even if i type some namespace or class name in the visual studio editor it is taking around 3 to 4 seconds to respond. Can any one help me on this i cannot remove the cs files from my project is there any workaround for this.
Thanks in advance
PS: May be this can help i am using clear case as my source control will that effect the performance of the visual studio .(My version of visual studio 2010 express edition)

You must be using a lot of unnecessary references in your project. Just go to the references section and delete those extra references.

There should be no problem with large/many .cs files. I have also solutions with 20 projects, some of these projects have many many files and some of these files have 2k - 5k lines of code. And I've no problem typing new code, there is no noticeable delay.
Perhaps it's only because of slow hardware?

Related

What is the limit of number of lines in a Visual Studio file (XML or cs)?

I have created an XML file in VS 2017 with 100,000+ lines and VS crashed every time I've tried to modify this file. (please don't tell me that my design is bad and I should use a database).
I have also created a unit test file with C# with more than 100,000 lines and VS 2017 also crashed every time I've tried to modify the file (.cs)
My pc is a Windows 10 with 24 GB of RAM so it is not a resource issue.
So my question is what is the max number of lines VS can handle correctly ?
Either you are trying to benchmark Visual Studio IDE for some research you are doing or you are in a real need to process large files.
If you are looking for benchmark I cannot help you.
If you are in a real need to process large files; I recommend you to split the file into smaller files as illustrated in the answer for this question:
XML Split of a Large file

How to stop visual studio from scanning all files and folders in my website when degugging

While trying to debug an asp.net website in visual studio 2013 professional I am having a weird issue. The website is simple but uses flat files and folder structure and files in it for performing some operations. There are two important folder in this website that contains 100 thousands of files and images. When I try to start debugging and do not remove files from these two folder then VS crashes and restart, but if I remove files then VS proceeds normally. The files in these folders are csv, txt and image files. What I can understand is that VS goes through all these folders and files before starting the debugger, hence somehow I need to tell VS to not to consider these folders. I am not able to find anything related to it. Please help. Thanks in advance.
Perhaps take a look at your Event Viewer first and see if you can find anything regarding VS crash.
Also you can try running Visual Studio from the command line devenv.exe /log and then load your solution. If crash still happens, then go take a look at following file %APPDATA%\Microsoft\VisualStudio\<version>\ActivityLog.xml. Perhaps you would find some more details about the crash.
If you happen to be using ReSharper, you might want to disable it and see if that would make any difference. ReSharper likes to index source files in the background which could lead to some usability issue in VS.
Answering for anybody who faces similar problem.
For some reason I dont know why, when starting degugging visual studio was scanning each and every folder, even the folders which doesnt contained any code file, this was making VS very slow due to very high number of files and out of memory exception was being thrown. Since in my case these folders doesnt contained any code file, but still were needed to run the application, I made them hidden from window explorer. This solved the problem as now vs ignores them, while still the program can output report and read reports from these hidden folders.

Visual Studio 2010 hangs after renaming projects in large solution

I have 1 large solution (about 100 c# projects and 20 c++ projects) in VS2010 + Resharper.
Well known steps for c# project renaming :
Rename project via project explorer.
Open project properties (right click) -> rename "Assembly name" and "Default namespace"
Open Assembly Info file -> rename neseccary properties in this file
Remove renamed projects from solution
Rename projects directiories on file system
Load renamed projects
After performing these steps for some C# projects (for example I renamed 10 projects), Visual Studio 2010 hangs. Work with the solution becomes fully impossible. It occurs on any machine when I try to open this solution.
The goal is to rename all projects. For example, every project's name pattern is : XXX.YYY.ZZZ and I want to rename them all according to a new pattern : YYY.ZZZ.
With more than 100 projects in two different languages it is very normal for VS2010 to freeze.I have about only 45 projects , Changing a class name freezes VS for a noticeable amount of time.
Then even though tedious i switched to Find and Replace,Basic but doesn't freeze VS..There is no other go. You have to deal with it.
Btw VS also needs a Huge database for maintaining c++ references and parsing information.

One file keeps opening in visual studio IDE

I'm using Visual Studio 2010
In one solution I have A.XAML file and it keeps opening every time I start solution. It also opens at some random time - I have no exact explanation.
It's very annoying. Why would VS open specific file by itself?
Does it open even when you create a new project? How about locating the file and renaming it does it help the problem? Also, have you tried to backup and remove the content of C:\Users\<your_username>\AppData\Local\Microsoft\VisualStudio\?
Update 1 based on comments:
So when you renamed all your A.XAML to B.XAML, do you get the A.XAML appearing or do you get a B.XAML file? Do you have many instances of the A.XAML file on your computer? If there are many, rename them differently so that you can subsequently identify the guilty one. Have you tried to 'Repair' VisualStudio through 'Add Remove Program' in Control Panel? Can you locate the A.XAML string in Regedit.exe? I think it could be useful if you would create a dummy project and ask a colleague or, friend to open it on their computer? (It would be helpful to get have a sample of that dummy project in order to troubleshoot whether it is the Project or, the IDE or, the OS which is the guilty party)
Update 2 based on further comments:
Recreating the .SUO file of the project fixed the problem. For example, renaming the .SUO file to .BAK and re-opening the project in Visual Studio.
What worked for me was running Visual Studio installer and choosing the repair option.
I had a whole solution that always opened a few seconds after I open any other solution. I didn't want to delete the solution so I thought I should try repairing Visual Studio (using VS2019). Haven't had any issue since.
Seems like an 'intense' option but it was what worked.

Long load time in Visual Studio for Large Project

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.

Categories