How to Suppress JIT optimization in .NET Core

708 Views Asked by At

I can't find a way to suppress JIT optimization in a .NET Core 2.2 process. This prevents me from attaching with a debugger in production and seeing all local variables.

In .NET Framework I could add an INI file with the same name as the DLL I wanted to prevent optimization as shown here. But this doesn't seem to work with .NET Core.

Debuggers like Visual Studio and dnSpy are able to suppress optimization when starting a process so it must be possible somehow. As a workaround, I could have started a process with a debugger but I'm using IIS and can't find a way to start the w3wp worker with it.

1

There are 1 best solutions below

3
On

Try setting environment variable COMPlus_JITMinOpts=1 for the process