To see if code was removed by optimization, do a release build. In Visual Studio, open Options from the Debug menu. Make sure that the following options are UNCHECKED:

  • Enable Just My Code
  • Suppress JIT optimization on module load (Managed only)

The debug options are global and will affect all projects.

Set a breakpoint, start debugging and open the Dissasembly window via Debug menu / Windows / Disassembly (Ctrl+Alt+D).