title: What is the cause of "This application has requested the Runtime to terminate it in an unusual way"?
body: <p>There's a common error that gets thrown by the Visual C Runtime:</p>
  
  <blockquote>
    <p>This application has requested the Runtime to terminate it in an unusual way.<br>
    Please contact the application's support team for more information.</p>
  </blockquote>
  
  <p>What does this error message actually <em>mean</em>?</p>
  
  <hr>
  
  <p>Let me use a parable to explain exactly what i'm asking.</p>
  
  <p>If I see a message:</p>
  
  <blockquote>
    <p>Exception: access violation (0xc0000005), Address 0x702be865</p>
  </blockquote>
  
  <p>This <em>access violation</em> has nothing to do with sexual harassment, or someone trying to break into my computer (any more than General Failure was a brigadier general who was trying to read my C drive, or that you could be hauled off to jail for performing an illegal operation in Windows 95).</p>
  
  <p>In this case, <em>access violation</em> corresponds to the constant <code>EXCEPTION_ACCESS_VIOLATION</code> (declared in <code>winbase.h</code> with value 0xC0000005). This constant one possible exception error code that can be returned in an <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363082%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>EXCEPTION_RECORD</code></a> structure. The code <code>ACCESS_VIOLATION</code> means that the program tried to read or write to an address in memory that it shouldn't be. If you try to read from a memory address that was never allocated, then you're doing something horribly bad - and the exception tells you so.</p>
  
  <p>It is <em>usually</em> caused when a program has a pointer to memory that is not, or is no longer, valid. The solution is stop trying to access memory that isn't valid.</p>
  
  <blockquote>
    <p><strong>Note</strong>: I'm <strong>not</strong> asking:</p>
    
    <ul>
    <li><em>why is program <strong>x</strong> getting a C0000005 error?</em> </li>
    <li><em>why is my code getting an access violation?</em></li>
    <li><em>how do I debug an access violation?</em></li>
    </ul>
  </blockquote>
  
  <p>So if I asked you, <strong>what causes an access violation</strong>, you wouldn't tell me to check the stack trace, or watch the output window, or to post sample code. You would say, <strong>"It is from trying to access memory that isn't valid."</strong></p>
  
  <h1>Back to my question</h1>
  
  <p>What does the following error mean:</p>
  
  <blockquote>
    <p><strong>This application has requested the Runtime to terminate in an unusual way.</strong></p>
  </blockquote>
  
  <p>I am (fairly) certain that the Microsoft Visual C Runtime library does not have a function:</p>
  
  <pre><code>void TerminateRuntime(bool UnusualWay);
  </code></pre>
  
  <p>So I have to try to figure out what it actually means:</p>
  
  <ul>
  <li>What does it mean to <strong>terminate</strong> the visual C runtime library? (msvcrt is a dll; you don't terminate it, you just don't use it anymore)</li>
  <li>What would be a <strong>usual</strong> way to terminate MSVCRT? </li>
  <li>Would someone <strong>choose</strong> to terminate it in an <em>unusual</em> way?</li>
  <li>Is today's <strong>unusual</strong> way actually a long since deprecated form of what used to be the <strong>usual</strong> way?</li>
  <li>If I <em>was</em> (mistakenly) terminating it in an unusual way, what would I do to terminate it in the <em>usual</em> way?</li>
  </ul>
  
  <p>In other words: what error is the MSVCRT catching, and hiding behind the uninformative error message?</p>