How-to-simply...

Debug with Release config when Cannot obtain value optimized away

  • 1 Error: Cannot obtain value of the local variable or argument because it is not available at this instruction pointer, possibly because it has been optimized away.
  • 2 VisualStudio 2017 -> Menu -> Tools -> Options -> Debugging -> General
  • 3 Check/Enable [x] Suppress JIT optimization on module load (Managed only)
  • N No need to disable 'Optimize code' option in build configuration.

References