Visual Studio "View Code" soo slow...
I don't know exactly why, but for some time, the first time I display a code window within Visual Studio there's intense disk activity for about 10 seconds. From that point on opening other source files is a snap.
It's late so I'm going to make this a short one.
Locating the problem:
1) I fired up SysInternals fileMon.
2) set it to monitor only the C: drive
3) turned off some disk intensive applications (Folding@Home, MSN Desktop search...)
4) Created a new project in Visual Studio
Stared at the fileMon log for about 30 seconds while Visual Studio was writing to the file:
C:\Documents and Settings\kim\Local Settings\Application Data\Microsoft\VisualStudio\8.0\1033\ExpansionsXML.xml
5) Googled for ExpansionsXML.xml
Turns out this is Visual Studio's cache for snippets. The size was about 800KB. I deleted the file and created a new project. Visual Studio created a new file, but this time the size was 210KB. It still took close to 10 seconds to display the first source file. I deleted all the snippet templates from:
C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\*.*
and
C:\Program Files\Microsoft Visual Studio 8\VB\Snippets\1033\*.*
Now opening a source file was instantaneous! Not that I use snippets a lot (I'm using CodeRush), but I still wanted the snippets to stay around so I restored the deleted snippets.
At this point I took a step back since something was puzzling me. Why does Visual Studio need to recreate the snippet cache every time I open Visual Studio? I only have a small amount of custom snippets and I almost never update my snippets.
How can I tell Visual Studio to stop caching the snippets if the cache is present?
I made the ExpansionsXML.xml read-only and that was sign enough for Visual Studio to stay away from the file!!!
I'm only smacking my head since this has been bugging me for a few days...