NGen failes with out of Memory error

Posted on 2014-03-09
Last Modified: 2014-04-14
I have a problem that has been around for some time. A while back I installed VS 2010 and MVC along with TeamViewer and some other VS components. At some point during this install something went wrong - most likely with the MVC Tools Update install.

The install would take several hours to complete - afterwhich it was found not to be on the system - after doing the install twice - I checked the logs and found it was terminating with an error and rolling back.

Since then anything that requires .Net 2 or 4 takes an age to install.

Pattern is this

Install script kicks of NGen install command.
Memory utilisation starts to climb rapidly until it is over 3GB.
Disk drive goes bananas for 2-10 minutes
Memory released only to start again with next NGen command.
NGen log shows command followed by 'Out of Memory' followed by NGen returned 0xffffffff
Sometimes packages install correctly.
Uninstalling a package takes just as long. For some reason NGen /uninstall goes through the same process as NGen install - massive memory consumption, high disk activity. Odd given uninstall should just be a delete.

As an indication - VS2010 took 9 hours to uninstall.

I also had to disable the MSCORSVW service - as it was continually trying to recompile assemblies - each of which goes through the process above - never completes i.e. when done /update runs again because previous failed.

I have tried removing all packages back to the pre-2010 install. I have also done a repair on all .Net installs.

No joy.

Found nothing on Google - except a few similar references with the only solution to rebuild OS - which is not an option.

Any ideas as to what be causing this
Question by:Julian Hansen
LVL 48

Expert Comment

ID: 39918518
Just a wild try, try verifying your .NET installation with the Aaron Stebner tool.
LVL 43

Expert Comment

by:Davis McCarn
ID: 39918890
Go to Add or Remove Programs in the Control Panel.  Locate the .Net entries, highlight each in turn, and, on most, if you click the support link, there will be a repair option.  If it works, great; otherwise, note that version and try all of them.
For any which could not be repaired, use the removal tool from dbruton's post to remove that version of .NET.
Then, download and reinstall those versions.
LVL 52

Author Comment

by:Julian Hansen
ID: 39920361
Thanks for the response.

@dbrunton - downloaded and verified each of the installations - all passed

@DavisMcCarn - I had already tried this - .Net does not offer a repair. If you go to Add / Remove programs and click  Change / Remove it asks if you want to uninstall - if you say yes you get a message that .Net can't uninstall because other apps depend on it.

I used the instructions here to run the silent repair option for .Net - made no difference.
LVL 43

Expert Comment

by:Davis McCarn
ID: 39920512
Do Start and, in the run box, type %temp%<enter>
In the window which appears should be the logs for .NET's installations which you need to inspect.  As a note, the last thing I think you wanted was a "silent" reinstall; you wanted to see the errors.

On my own PC I have .NET 2, 3, 3.5, and 4.  2 has a repair option in "Click here for support information".  All of the others have it under Change/Remove.
LVL 52

Author Comment

by:Julian Hansen
ID: 39920699
The change option is available on 2 upwards it seems. Clicking it resulted in the following
RAM usage went up to 3.8GB from 1.1GB (see image)
The dialog in the screen shot below was on screen for more than 10 minutes while the disk did gymnastics.
ScreenshotThat was all that was displayed - after approx 12 minutes the disk quieted down and the dialog dissappeared - nothing else displayed

Same problem seems to exist after having done that.

The question is - is a .Net install just a memory hungry beast or is it just my installation.

I know for a fact there were no issues prior to the VS2010 install - the NGen logs show no Out of Memory errors prior to the install of VS2010 but they are all over the place after that. I also know that installations prior to VS2010 being installed did not take 8 hours to install and definitely did not take that length of time to uninstall.

Still can't figure out why NGen has to work so hard on an uninstall.
Do email signature updates give you a headache?

Are you constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

LVL 43

Accepted Solution

Davis McCarn earned 500 total points
ID: 39920832
One (or more) of your .NET installations is corrupt and it gets a bit risky fixing it; but, I have done it more than 50 times.
I would uninstall VS2010 and NGEN then try uninstalling each version of .Net.  Hopefully; they will all go away nicely; but, I'll bet one or more won't.
For those that don't , here is a cleanup tool and an article on how to use it including reinstalling .NET:
LVL 52

Author Comment

by:Julian Hansen
ID: 39921177
I would uninstall VS2010
Already did that - took 9 hours - no joy.

Uninstall NGen - thought NGen was part of .Net? How do you uinstall it without removing .Net

Will try the cleanup tool.
LVL 43

Expert Comment

by:Davis McCarn
ID: 39921557
NGen requires that .NET be up and operational......
LVL 59

Expert Comment

ID: 39975417
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
LVL 52

Author Comment

by:Julian Hansen
ID: 39975418
Question has not been abandoned - I am still working on the problem.

I will close this question once I have exhausted all options.
LVL 52

Author Closing Comment

by:Julian Hansen
ID: 40000099
I have given up on resolving this. Have acquired a new PC.

I did follow the instructions posted by Davis - and this had some limited effect in that mscorsvw stopped misbehaving - but still cannot uninstall certain apps without it taking hours.

I have awarded a B to the solution - not to the expert - as the solution partially deals with the problem but did not yield a definitive answer. It may be useful to others reading this post.

@Davis - thanks for the input and effort - appreciate it - looks like Microsoft wins this round though.

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now