Microsoft Native Image Generator (NGen) – disable the use of all NGen images

1. Set the environment variable COMPLUS_ZAPDISABLE=1 or the registry key HKLM\SOFTWARE\Microsoft\.NETFramework\ZapDisable

This parameter will disable loading of native images – if you set this system wide your application will start much slower but all of your code will be JITed now

2. Create a file in C:\Windows\Microsoft.NET\assembly
\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.ini with the content

[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

This will disable JIT optimizations for a given dll where the ini file must be named for an assembly <name>.dll like <name>.ini – you need to do this for each assembly you want to disable JIT optimizations

Leave a Reply

You must be logged in to post a comment.