title: Is there a way to *completely* disable Edit and Continue?
body: <p>I was wondering if there was a way to completely lock my code while debugging it within Visual Studio 2008. The code documents lock automatically when running as 64 bit applications, which I greatly prefer; however, I do most of my coding making add-ins for Excel, which is 32 bit. The result is that even though I target 'AnyCPU', the VS host knows that it is running within a 32 bit process and, therefore, the source code is <em>not</em> locked while the code is running hosted in Visual Studio.</p>
  
  <p>I can turn off Edit and Continue by going to Tools > Options > Debugging > Edit and Continue, and then unchecking the 'Enabled Edit and Continue' check box. This does not completely lock the code, however. This does prevent any edits in the code from being executed in the <em>current</em> run, but it does not prevent mouse clicks or keystrokes from actually changing the code.</p>
  
  <p>Again, when working with 64 bit applications this does not occur -- the code is completely locked. I greatly prefer the code to be completely locked for at least a couple of reasons:</p>
  
  <ol>
  <li><p>I can accidentally hit a key or the like while debugging, which I definitely do not want to do. It's rare, but it is an issue.</p></li>
  <li><p>Many of my automated tests drive the user interface via SendKeys. When stepping through such a test using the debugger, however, I can sometimes forget that some of the aspects involve SendKeys, which means that keystrokes wind up getting sent to the Visual Studio IDE instead of Excel. </p></li>
  </ol>
  
  <p>In issue #2, above, the unit test fails, which is fine -- my bad -- but having all the keystrokes sent to the code module and destroying my code is completely unacceptable.</p>
  
  <p>Does anyone have any ideas here? Can one completely lock the code when running hosted in Visual Studio while compiled against a 32 bit CPU?</p>
  
  <p>Some related posts on this issue, but none of which directly address this:</p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/7yty6a48.aspx" rel="nofollow noreferrer">How to: Enable and Disable Edit and Continue</a></li>
  <li><a href="https://stackoverflow.com/questions/1498464/changes-to-64-bit-applications-are-not-allowed-when-debugging-in-visual-studio">“Changes to 64-bit applications are not allowed” when debugging in Visual Studio 2008</a></li>
  <li><a href="https://stackoverflow.com/questions/1105292/how-do-i-enable-file-editing-in-visual-studios-debug-mode">How do I enable file editing in Visual Studio’s debug mode?</a></li>
  <li><a href="https://stackoverflow.com/questions/224500/how-does-edit-and-continue-work-in-visual-studio">How does “Edit and continue” work in Visual Studio?</a></li>
  <li><a href="https://stackoverflow.com/questions/1659835/can-we-edit-our-code-while-running-the-application">Can we edit our code while running the application</a></li>
  <li><a href="https://stackoverflow.com/questions/447706/editing-c-while-debugging">Editing C# while debugging</a></li>
  </ul>
  
  <p>Thanks in advance for any help or ideas...</p>
  
  <p>Mike</p>