windows 7 - ngen.exe is constantly using CPU

06
2013-08
  • teedyay

    I recently installed Windows 7. This was a clean install (i.e. not an upgrade from another version of Windows), but I did install a bunch of other programs. All mainstream applications - nothing wacky.

    Since then, my CPU usage has been constantly at around 50%.

    Task Manager shows me that ngen.exe is the culprit. It's not a long-running task: I can see that it gets a new PID at least once a second, so I guess something is constantly triggering it.

    It does it all the time, even when I have no applications running.

    Has anyone else seen this? How do I find out what's causing this?

  • Answers
  • Jim B

    NGEN is the native code generator for the dotnet framework. it will churn away as a background task until the native assemblies have been generated

  • 8088

    Following Isxek's advice, I used Process Explorer to see what's going on. I found this:

    enter image description here

    Processes that are ending are highlighted red; ones just starting are green. This shows that ngen.exe is constantly ending and being restarted. From the graph at the top you can see it runs for about one second each time.

    As Jim B says, netfxupdate.exe is working its way through the .NET framework. Mine had been going for several weeks, so for some reason it looks like it had got stuck on something and wasn't making any progress.

    Using regedit, I found the entry that starts netfxupdate.exe whenever I start up my PC:

    enter image description here

    It looks like it's stuck on the .NET 1.1 libraries for some reason. I'm a .NET developer and some of my code runs on .NET 1.1. It all seems to be working fine, so I removed this entry from the registry and rebooted my machine.

    It's been a couple of days now with no problems (even when developing against .NET 1.1), so I'm happy with this solution.

  • 8088

    The file ngen.exe appears to be part of Microsoft .NET Framework, according to ProcessLibrary.com. I did a search for it in a Windows 7 laptop I'm using, but I could not find it.

    You could use Process Explorer to determine whether it's a legitimate file from Microsoft. Right-click on ngen.exe there when you see it, choose Properties, then click on the Verify button. You should see something like this (the image is for svchost.exe):

    enter image description here

    If it does not register as verified, you might want to try the advice given here: What to do if my computer is infected by a virus or a malware?

  • Hornblower409

    FYI - The NetFxUpdate on my Windows 2008R2 got stuck as well after I installed v1.1, %temp%\netfxupdate.log shows:

    START: invocation ID = 1; version = v1.1.4322; params = 
    REGWRITE: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce NetFxUpdate_v1.1.4322="C:\Windows\Microsoft.NET\Framework\v1.1.4322\netfxupdate.exe" 0 v1.1.4322 GAC + NI NID
    REGDELETE: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run NetFxUpdate_v1.1.4322
    INVOKE: "C:\Windows\Microsoft.NET\Framework\v1.1.4322\netfxupdate.exe" 2 v1.1.4322 NI NID
    START: invocation ID = 2; version = v1.1.4322; params =
    

    and then (over and over again):

    INVOKE: "C:\Windows\Microsoft.NET\Framework\v1.1.4322\ngen.exe" /nologo /silent "C:\Windows\Microsoft.NET\Framework\v1.1.4322\System.dll"
    RETURN: -1
    

    Same fix as you, remove the HKLM...\Run key.

  • white.zaz

    I have faced with this problem too. But the answer of teedyay didn't help me. The solution which DID help is Disabling Automatic Updates. See http://superuser.com/a/502049/201171


  • Related Question

    Windows 7 Installer Constantly Running
  • Steve Horn

    I'm running Windows 7 RC. Recently I noticed that my CPU was being pegged by msiexec.exe. Another symptom is that when I try to uninstall applications from the control panel I see this error:

    "Another program is being installed. Please wait until that installation is complete, and then try installing this software again."

    It's like the installer service is performing an installation in the background. I've rebooted several times, but nothing has worked.

    Is there a way to get the msiexec service to forget about whatever installation it's trying to perform?

    Thanks for any help!


  • Related Answers
  • Steve Horn

    Solved: Disabled the Windows Installer service in the administrative services list.

    Reboot.

    Re-enable the service (set to manual start)

    Reboot.

  • tjrobinson