I recently added about a dozen classes from another solution into my current solution in Visual Studio. After adding these classes, Visual Studio started freezing for about 10 seconds whenever I Save. The cursor disappears and mouse clicks and keys do nothing.
Some interesting points:
Even after I removed the classes, the freezing behavior is still there.
Freezing occurs whether I've made changes to the code or not.
This behavior ONLY seems to affect this particular version of this solution. No other solutions exhibit this behavior. Older versions of this solution are not affected.
In Sysinternals Process Explorer, whenever I save in Visual Studio, the I/O bytes graph jumps from 0 to 2MB for about 5 seconds, then drops to about 1 MB for a split second, then jumps back to 2MB for another 5 seconds. Processor use goes up to about 3-5% during this time.
Here are the details of my setup:
C# Silverlight project (maybe 20 classes), .NET version 3.5 SP1, Visual Studio 2008 v9.0.30729 S开发者_如何学编程P1.
EDIT:
I edited this question extensively to reflect the more detailed information. I thought this might be preferable to starting a new question.
I can't be sure if it's the same issue, but I've experienced similar slowdowns because of the Windows Forms Designer. I fixed this by going to
Tools --> Options --> Windows Forms Designer
and turning AutoToolboxPopulate to off. It's a longshot, but you might as well give it a try. Also, one thing I do for larger solutions is compile from the command line instead of in visual studio. You just need to open a Visual Studio Command Prompt and use msbuild (solution name | project name). You can also use /m for multicore compilation.
I had a similar issue, this did the trick: http://support.microsoft.com/kb/946344 titled 'You may experience performance issues in the IDE after you use Visual Studio 2008 to build a Visual Basic project'
Just finished an all day chase down of this bug. In my experience I found it to be dependent on line count. This value was machine specific however. On my machine it was a line count limit of 35,129 and was not size specific. A coworker did not have the same issues when saving the same file however I was able to recreate the problem inserting blank lines. I then retracted to one line less then the threshold and added characters to increase the file size which did not create a problem so I can say with certainty that for me it was about line count. An indicator also might be a small bent blue arrow next to the line count in VS. When I would exceed the line count this indicator appeared on line 35,129.
Edit: If this is your problem(and represents a very large class) then a suitable fix can be implemented through partial classes. For more info check out http://www.techrepublic.com/article/splitting-a-class-across-files-in-vbnet/6179621
精彩评论