title: What causes the Visual Studio Modules (for C++ Projects) Window to write Yes against the Optimised Column?
body: <p>What causes the Visual Studio Modules Window (for C++ Projects) to write Yes against the Optimised Column?</p>
  <p>Until today I would have thought the answer to this question was simple, just make sure that all the optimisations are disabled.</p>
  <p>In our main branch a colleague added a special project to bootstrap the special login code that runs for the main C++ projects to connect to the database, but in a project to be consumed by a new WPF C# App.</p>
  <p>When the WPF App starts running special StartSession code runs within the Session DLL which causes the WPF App to be connected to the database.</p>
  <p>If you put a breakpoint in the StartSession function then the modules window will show:</p>
  <pre><code>Name               Path                        Optimized      Symbol Status    AppDomain
  ============       ====                        =========      =============    =========
  Session.dll        C:\somepath\Session.dll     No             Symbols Loaded   [1] DefaultDomain
  Session.dll        C:\somepath\Session.dll     No             Symbols Loaded   
  Session.dll        C:\somepath\Session.dll     No             Symbols Loaded   
  </code></pre>
  <p>In the C++ Project property pages, Optimization = <strong>Disabled</strong> (/Od), Inline Function Expansion = <strong>Only __inline (/Ob1)</strong></p>
  <p>All the rest are set to No or Either (all in non-bold)</p>
  <p>I needed to create a similar project for my unit testing project with Catch2, so I duplicate the folder into my branch, edit the project file to change its details to reflect the new name, add a 2nd Configuration copied from the first called &quot;Catch2 Debug&quot;.</p>
  <p>Then through a DLL Export I link it to my unit testing executable, but now when the module is loaded the details change</p>
  <pre><code>Name               Path                                   Optimized      Symbol Status    AppDomain
  ============       ====                                   =========      =============    =========
  Session.dll        C:\unittestpath\UnitTest.Session.dll   Yes            Symbols Loaded   [1] DefaultDomain
  Session.dll        C:\unittestpath\UnitTest.Session.dll   No             Symbols Loaded   
  Session.dll        C:\unittestpath\UnitTest.Session.dll   No             Symbols Loaded   
  </code></pre>
  <p>The reason this matters to me is that something is going wrong within the initialisation, so I need to be able to look at the contents of the variables, but when I add them to the watch window I receive the message <code>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.</code> instead of the evaluation of the variable.</p>
  <p>I also tried generating the project from scratch and adding the relevant source files, however still the same result</p>