title: Is it possible to create mini dump file programmatically without a crash?
body: <p>Assume a remote site gets a rare error but <em>doesn't</em> crash the application. I would still like to create a mini dump file when this happens so I have some information to work with, mainly the call stack.</p>
  
  <p>Pseudo code is following:</p>
  
  <pre><code>try
  {
      doStuff();
  }
  catch(_com_error &amp;e)
  {
      make_minidump(); // is this possible?
  
      dump_com_error(e);
      return FALSE;
  }
  </code></pre>
  
  <p>All the examples I see requires that I will have to cause the application to crash (for demo purpose at least) to produce dump file but I don't want to do that. Is it possible to create dump file like this?</p>
  
  <p>I know I can go to task manager and create dump file of a running process and likewise I can use ProcessExplorer to achieve the same, so it seems like it should be possible.</p>
  
  <p>At the same time in all examples I see, dump file is generated only when controls comes to <a href="https://msdn.microsoft.com/en-us/library/ms680634(v=vs.85).aspx" rel="noreferrer">SetUnhandledExceptionFilter</a> which is called when an application crashes!</p>
  
  <p>As a last resort, is the only way to get dump file generated is to deliberately crash the application with something like below: Will that produce anything useful beyond the crash? because I know what caused the crash in this case.</p>
  
  <pre><code>LONG CALLBACK unhandled_handler(EXCEPTION_POINTERS* e)
  {
      make_minidump(e);
      return EXCEPTION_CONTINUE_SEARCH;
  }
  
  int main()
  {
      SetUnhandledExceptionFilter(unhandled_handler);
  
      return *(int*)0;
  }
  </code></pre>