Windows – ngen.exe high cpu windows 10 – Assemblies Uninstall Endless Loop

.net frameworkcpu usageregeditwindows

Whenever I leave my computer idle for a few minutes I come back and my Process Explorer shows that 'ngen.exe' is running and occupying 2 of my 4 cpus.

Question: Is there a way to turn NGEN.exe off as a background task?

I'd like to (as do many others on the internet) compile all the .net binaries all at once instead of having the computer 'automatically' doing so every time I leave the computer idle. I've checked throughout Microsoft forums and so far nobody has a complete answer to this problem, and many are having the same issues.

Apparently some library in .net framework is needing to be recompiled and it gets 'stuck' and puts the CPU into high and loops over and over again.

I've just experienced this same issue and there is another thread attempts to answer it but it is incomplete

Regedit of /HKLM/SOFTWARE/Microsoft/Windows/Current Version/RUN has no entry to run the .net compiler. Something else must be causing ngen.exe to trigger.

Can someone post other locations that might be triggering this to run?

I'd like to turn it off as I'm sure many others would. I also disabled automatic updates in Windows 10.

UPDATE: Process explorer says this is what is running:

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" uninstall "C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\Microsoft.Vf‌​9a08577#\328b1bc4205‌​c08821860805bf5e6c99‌​e\Microsoft.VisualSt‌​udio.Tools.Applicati‌​ons.Hosting.ni.dll" /noroot /LegacyServiceBehavior – Viktor 5 mins ago

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe" uninstall "C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\Presentation‌​Framewo#\7fa93028119‌​b98117acfd5ea18f15c1‌​3\PresentationFramew‌​ork.ni.dll" /noroot /LegacyServiceBehavior – Viktor 4 mins ago edit

"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe" uninstall "C:\WINDOWS\assembly\NativeImages_v2.0.50727_64\Microsoft.PowerShel#\23dfb41f48958215c80bbbc0c9177cb2\Microsoft.PowerShell.Commands.Utility.ni.dll" /noroot /LegacyServiceBehavior

It keeps running over and over and over again. – that's the output from Process explorer. Its extremely annoying and it seems to happen EVERY TIME I leave my desk.

QUESTION: it seems like these are legitimate processes. Does anyone know a way to manually remove those uninstall commands and compile the .net framework completely 1 time instead of having it loop over and over again?

CURRENTLY TESTING: I killed the process and ngentask.exe then went to Windows\assembly and moved those Native Image folders to a temporary directory. I'll keep you posted if it starts back up again. Chances are if the NativeImages folders are missing it won't try to keep uninstalling those assemblies.

Best Answer

  • Download the Easy NGEN Script, run it as admin and select option 1 to do a full ngen run:

    enter image description here

    This takes alot of time and does all pending ngen operations. After this the ngen queue is empty and you shouldn't see the other tasks again.