My Visual Studio 2010 always slows down or crashes when working with a specific solution. And by slow, I mean SLOW! For example, I can type in 4-5 characters per minute. And usually the UI freezes, and sometime ultimately crashes down. So, basically I can't work with the solution. I tried these solutions with no effect:
- Disabling and uninstalling all extentions.
- Removing .suo, bin, and debug folders
- Disabling IntelliSense, text editor options,...
- Rebooting the system
- Trying it on different computers with same versions of VS and Windows (7).
¿Alguna idea de cómo solucionarlo?
preguntado el 28 de agosto de 12 a las 14:08
So, after hours of trying out everything, I figured out that the crash happens when working on a specific file. Particularly, the issue was with this line of code:
d = sd.Categories.Max(cat => cat.Subcategories.Max(d => d.Data.Where(a => a.CountryName != "World" && a.CountryName!="Asia Pacific").Max(a => a.AnnualData.Max(ad => ad.Value)));
Apparently, since the line uses many lambda expressions, the VS parser cannot handle it efficiently, though it is a syntactically and semantically correct expression, and it's compiled and executed correctly.
Solution: Remove or comment the line, and use a set of shorter expressions to perform the same functionality. I just used some nested foreachs to replace the expression.