Mscorsvw.exe and Ngen.exe high CPU usage

I could not stand that my laptop was blowing all day like a hairdryer and had to search for a fix.

High CPU

Taskmanager was showing that The .NET Framework optimization service and mscorsvw.exe areusing moderate CPU, but enough to let me fans blow fast.

After some searching I came across
https://blogs.msdn.microsoft.com/dotnet/2013/08/06/wondering-why-mscorsvw-exe-has-high-cpu-usage-you-can-speed-it-up/

and

https://blogs.msdn.microsoft.com/davidnotario/2005/04/27/what-is-mscorsvw-exe-and-why-is-it-eating-up-my-cpu-what-is-this-new-clr-optimization-service/

Basically explaining that mscorsvw.exe is precompiling .NET assemblies in the background. Once it’s done, it will go away.

The issue

The issue I am having is that the service will never stop running. The blogs also show a way to run the compiler with more CPU power using NGEN.exe directly:

ngen.exe executeQueuedItems

After trying this, the output shows error after error and never finishes

and now I understand why the service never stops.
Also tried reinstalling and repairing .NET etc etc, nothing fixed this.

The ‘fix’

The service is started by a scheduled tasks which are located under Microsoft > Windows > .NET Framework

The workaround for me was to disable the tasks.
You could also use Powershell: Get-ScheduledTask *ngen* | Disable-ScheduledTask

If the task is running, you need to restart your computer first to stop it… and never let it start again.

—

Thank you for reading my blog.
If you have any questions or feedback, leave a comment or drop me an email.

Darryl van der Peijl
https://twitter.com/DarrylvdPeijl

3 thoughts to “Mscorsvw.exe and Ngen.exe high CPU usage”

  1. Hi Darryl,
    I’ve been having the same problem on Microsoft Windows 2019. The mscorsvw.exe just keeps running and using 10% or more of the CPU.
    I have read that you are really not suppose to “disable” the NGEN.
    Do you have any more thoughts about this issue since you wrote the post above?

    1. As I understand it’s only re-compiling images, I do not have any problems when disabling but no expert on this part 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *