Disabling JIT optimizations while debugging

If you’ve ever been debugging a managed app, only to be unable to evaluate any of the locals or parameters because the code was "optimized", check out the article below.  It shows a quick trick to disable optimizations by way of a .ini file.  This is great because it doesn’t force you to recompile the application and takes only seconds to implement.

The short version is create an .ini file (i.e. myapp.ini) with the following contents.

[.NET Framework Debugging Control]

This has really saved me time debugging recently.  It’s been blogged about by several others but given that I’ve had to search for this solution 3 times in as many weeks, I figured blogging about it would make it easier to find next time :)


Comments (2)

  1. Sooner or later you may run into a situation where you need to evaluate a local variable under debugger