Click here to Skip to main content
Click here to Skip to main content

Tagged as

Out of Memory in Visual Studio

, 27 Aug 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
The "ResolveManifestFiles" task failed unexpectedly. System.OutOfMemoryException: Insufficient memory to continue the execution of the program.

Introduction

As part of assignment, I was working on a project, which is having 137 projects Windows Form in a solution. Whenever I was building my solution, I was getting Out-Of-Memory error and due to this my Visual Studio use to get crash. Then the only solution left with me was to restart my Visual Studio L. Earlier I as facing this issue once a while, but from last week, it is occurring frequently. Hope you can imagine, how painful it is restart the Visual Studio every now-and-then, especially when your solution contains such a huge number of projects. My error was something like this: “The "ResolveManifestFiles" task failed unexpectedly. System.OutOfMemoryException: Insufficient memory to continue the execution of the program.”

The only thing, which was coming into my mind, was that it is due to Visual Studio’s memory limits. I also tried to minimize Visual Studio, but no luckL.

After consulting with few people, I got an idea to breakup my solution into multiple solutions. But again, it was not the best solution for me because my project was already on the last stage (about to over) and it was not the correct time to take this much big risk. So, I dropped this suggestion also.

After hitting my head for 4-5 days, I reached to some conclusion. One of the reasons was Heap fragmentation, due to which, my Virtual Memory was keep raising and ultimately it was affecting my GC. But this reason was also not 100% correct. Because Virtual Memory will rise, only when I’ll run my application. But in my case, I was getting error during build itself. So, again no luck L

While doing analysis on the same, I thought, let’s open manifest file and check once. And luckily I got the clue. On opening manifest file, I found that there are lot of hash values which are nothing but my image files. In my project I was using approx 150 image files. According to my project requirement, we were not supposed to deploy those image files. Then what those files were doing there, why they are part of my manifest?  Now a very BIG question was, how those image files became part of my manifest?

This happened because Visual Studio, by default sets image’s ‘Build Action’ property to ‘Content’. As soon as I changed this property to ‘None’, my error goes off. This one small property worked like a charm for me J

By setting ‘Build Action’ property to ‘None’, I was able to reduce the size of manifest file to approx 0.9GB.

I shared this as a tip, so that you need not to spend 5-6 days, to analyze the issue J

Points of Interest

Whenever you get out of memory error in visual studio, one possible reason can be due to huge manifest file. So, just try to play around it and you will get some clue Smile | :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shweta Lodha
Technical Lead
India India
You can also follow me at my blog http://www.shwetalodha.blogspot.in/
Follow on   Twitter

Comments and Discussions

 
QuestionOut of Memory in Visual Basic 6.0 PinmemberMember 1130203810-Dec-14 15:41 
QuestionWhere is the Build Action Setting? PinmemberJoe Sweeney24-Apr-13 10:50 
GeneralMy vote of 5 PinmemberChristian Amado27-Aug-12 10:17 
Nice tip!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 27 Aug 2012
Article Copyright 2012 by Shweta Lodha
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid