views:

1518

answers:

3

We have VS.Net solution with 20 projects in it.

Occasionaly, in VS.NET, when we try to build/debug our solution, we get following error:

Unknown build error, 'Exception of type 'System.OutOfMemoryException' was thrown

Only way to "fix" this issue is to reopen Visual Studio and then solution build goes well, but again after some time OutOfMemory exception occur again. It's really annoying to reopen Visual Studio couple times a day, so do you know some workaround for this issue ?

+2  A: 

According to what Microsoft recommends, it is not a good idea to have lots of projects within a single solution.

Check out this link http://support.microsoft.com/kb/949755 .

But the solution suggested in the article is not something that be straight away used, because of the code refactoring costs involved.

Have you tried building the solution from outside the IDE. (Something like MSBUILD). That might help.

Prashanth
We didn't separate our code in few solutions for the reason you stated: refactoringBuilding outside of IDE works well, only problem is VS.NET build
m1k4
+2  A: 

I have the same Issue if I use ReSharper and run several UnitTests (with enabled CodeCoverage).

I also assume this is a ReSharper problem. And since I disble it while I'm running Unittest the Exception never appears again.

BTW - Disabling it when the exception throws (as mentioned in the comments above) doesn't help, because of disabling it while VS is running will not unload it from memory. The only way to force the unload is to tear down all AppDomains which have loaded the DLL. In a VS Package scenario this means you have to tear down the entire VS process :(

Sven
Guess you're right. I turned off ReSharper, restarted VS and I'm waiting couple of hours to see if it will happen again. If not you get +1 :) and I'll see what to do then with ReSharper :/
m1k4
+1  A: 

JetBrains is aware of this issue, and they provide some fix for it, using this fix solved my problems for now:

http://www.jetbrains.net/confluence/display/ReSharper/OutOfMemoryException+Fix


Edit: However, OutOfMemory exception is occuring again, but it's not as often as it is when I dont use this JetBrains fix.

m1k4