1

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.

Michael_S_
  • 488
  • 4
  • 11
  • 26

1 Answers1

0

Try setting environment variable COMPlus_JITMinOpts=1 for the process

Alex Buyny
  • 3,047
  • 19
  • 25
  • Have you tried (if at all possible) to deploy debug build to production? It must be some environment variable... You could start process with a debugger where you notice JIT optimization is suppressed, and then make the application to output all its environment variables. – Alex Buyny Dec 02 '20 at 02:00
  • Also make sure that your app actually sees `COMPlus_JITMinOpts=1` by making the app to output that value to console or somewhere else. – Alex Buyny Dec 02 '20 at 02:13
  • @AlexBuyny Yes I made sure with logging :) As for deploying debug build - yes, it works but that's exactly what I want to avoid. I want to be able to change without redeploying. – Michael_S_ Dec 02 '20 at 08:56